0.2.13 • Published 8 years ago

syncsocket v0.2.13

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

SyncSocket

Synchronized messaging application framework server

Build Status codecov npm npm PRs Welcome

API Docs

Channel

Channel constructor.

Parameters

  • server Server The server object
  • opts object Options
    • opts.channelId string The channel id (string). If not passed, will generate a random one
    • opts.timeserver string The timeserver which channel will use (if not set, will use the server's default)
    • opts.autoSyncClients boolean Automatically instruct unsynchronized clients to re-synchronize

addClient

Adds client to the channel

Parameters

  • client Client

hasClient

Whether a client is joined this channel

Parameters

  • client

Returns boolean

Channel#error

Channel error

Channel#join

Client joined the channel

Channel#left

Client left the channel

Channel#clientStateChange

Client has switched state

Properties

  • client Client
  • newState string

Channel#scheduledMessage

An event has been scheduled

Properties

Server

Server constructor

Parameters

Properties

  • embeddedTimeserver boolean If set to true, an embedded timeserver will be launched
  • timeserverHost string Clients will connect to this timeserver if no timeserver specified for channel
  • timeserverPort number Clients will connect to this timeserver if no timeserver specified for channel

timeserverUrl

URL of server's default timeserver (set via timeserverHost() and timeserverPort())

Returns string URL

serveClient

Sets/gets whether client code is being served

Parameters

  • v boolean whether to serve client code

Returns (Server | boolean) self when setting or value when getting

embeddedTimeserver

Sets/gets whether embedded timeserver is active

Parameters

  • v boolean whether to activate integrated timeserver

Returns (Server | boolean) self when setting or value when getting

timeserverHost

Sets/gets timeserver host to which clients will connect if no timeserver specified for channel

Parameters

Returns (Server | string) self when setting or value when getting

timeserverPort

Sets/gets timeserver port to which clients will connect if no timeserver specified for channel

Parameters

Returns (Server | number) self when setting or value when getting

listen

Attaches to a server or port

Parameters

Returns Server self

createChannel

Creates a channel

Parameters

  • channelId ?string channel id or null. If null, then id will be generated

Returns ?Channel that has been created or null

addToChannel

Adds a client to a specific channel

Parameters

  • client Client
  • opts object Options
    • opts.channelId string The channel ID to add client

Returns boolean Operation result

getChannel

Get specific channel

Parameters

  • channelId Channel id

Returns ?Channel

close

Shuts down the server

Returns Server

Server#connection

Client has successfully connected

Server#disconnect

Client has disconnected

0.2.13

8 years ago

0.2.12

8 years ago

0.2.11

8 years ago

0.2.10

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago