0.0.5 • Published 6 years ago

rkv-signaling v0.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Signaling

This package allows you to create applications and games where you can have communication between browsers with minimal lag.

It uses WebRTC and adds an abstraction on top of it which makes it easier to work with.

It can be used for games where one browser is the game screen while a mobile phone browser is the controller.

Index

  • Getting started
  • API
  • Events

Getting started

Usage of the signaling module is split into three parts:

  • Initiator

  • Receiver

  • Broker

API

import signaling from 'signaling'

signaling.runReceiver(options)

TODO: Add description here

Arguments

options (object):

OptionTypeRequiredDefaultDescription
wsAddressString-TODO
receiverIdString-TODO
onInitiatorJoinFunction-Function that is run whenever an initiator joins
onInitiatorLeaveFunction-Function that is run whenever an initiator leaves

onInitiatorJoin arguments

The onInitiatorJoin function is always called with an object with these properties:

PropertyTypeDescription
idString

setOnData send close

Returns

Nothing


signaling.runInitiator(options)

TODO: Add description

Arguments

options (object):

OptionTypeRequiredDefaultDescription
wsAddressString-The address of the broker
receiverIdString-The id of the receiver to join

Returns

(Promise): The promise is resolved with an object with these keys:

PropertyDescription
setOnDataTODO
setOnCloseTODO
sendTODO

Events

import { Event } from 'signaling'
EventDescription
ANSWERTODO
INITIATOR_CANDIDATETODO
RECEIVER_CANDIDATETODO
RECEIVER_UPGRADETODO
OFFERTODO
NOT_FOUNDTODO

Example

Event.ANSWER
0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago