0.0.7
The Ethermeris Manager. This class holds multiple servers and automatically routes clients to specific servers. Handles WebSocket upgrades, WebRTC Signalling, and ICE Candidate exchanges. Also hosts the client library file.
(ManagerSettings)
Ethermeris Manager Settings
Creates a server and attaches it to this manager.
(ServerSettings)
The Ethermeris Server Configuration
EthermerisServer
:
Attaches an existing server to this manager.
(EthermerisServer)
The Ethermeris server to attach
(String | Number)
:
Returns the server's ID
The Ethermeris Server. This class contains the state, networker and event emitter. It is not meant to be used bare. Use the Manager to create servers instead.
(ServerSettings)
Ethermeris Server Settings
Obtains the server's WebSocket server
WebSocketServer
:
Returns all clients connected to the server
Object<ClientID, ClientConnection>
:
Work-In-Progress Method
(any)
Emits an event to all connected clients.
(...(Object | EthermerisServer~clientModifierCallback))
The event data. Can also be a callback that returns event data.
Boolean
:
Returns true on success, false on failure.
Adds an event responder. It's like an event handler, except only one handler per event and that handler can return a value.
(Function)
Event responder listener to add.
EventEmitter
:
Sets the state of the server using a partial state, finds the differences between the new state and the old state, then emits those differences to all clients.
(Object)
A partial object that gets merged into the main state to update it.
(EthermerisServer~clientModifierCallback?)
An optional callback Function that is called to modify all diffs for specific clients.
(Boolean?)
If set to true, the newPartialState will be merged into the main state by just the parent object keys.
Useful for optimization if you already have an entire state to set.
Pre-flight per client state difference modifier callback. Its return value will be the new diff to send to the client.
Type: Function
(ClientConnection)
The specific client.
(Object)
The object differences to be modified.
The Ethermeris Client. This class contains WebSocket/WebRTC connections, an event emitter, the local state, and responders. This class is only meant to be used on the browser to connect with Ethermeris servers.
(ClientSettings)
Ethermeris Client Settings
WebSocket Instance - Only used when in WebSocket mode.
Type: [type]
Initiates the client by choosing the best connection method.
EthermerisClient
:
Destroys this instance and terminates all connections.
[type]
:
[description]
Adds an event responder. It's like an event handler, except only one handler per event and that handler can return a value.
(any)
(Function)
Event responder listener to add.
EventEmitter
:
Disconnection Event.
Connection Event.
Connection Event.
(ClientConnection)
The connection of the client that just connected.
(Object)
Object containing the data that the client sent over in the connection request.
Disconnection Event.
(ClientConnection)
The dead connection of the client that just disconnected.
A Server's Client Connection. This class represents a connection to a client on the server. The server can use this class to send events and requests to the client. Not meant to be used bare.
Type: Object
((String | Number)?)
: The ID of the server. Used by the client to select a specific server. An ID is automatically generated if omitted.
(Object)
: The initial state of the server. No new keys should be added to the state after it is set.
(Function)
: A callback function that returns the initial data that gets sent to the user on connection.
(Number)
: The maximum amount of messages per second allowed. The client is automatically disconnected if this threshold is broken.
(Number)
: The client will disconnect when this amount of time passes with no messages sent from it.
(Object)
: The RTCPeerConnection settings object.
Type: Object
(NodeHTTPServer)
: The Node.js HTTP Server to attach the manager to.
(String?)
: The root route that the manager uses for all server communications.
Type: Object
(Boolean?)
: If set to true, the client's operations are logged to the console.
(Boolean?)
: Forces the client to use WebSockets.
(String?)
: Root server route to use when signalling and exchanging candidates.
(Function?)
: This function gets called if initial data is required to connect to the server.
(Object)
: The RTCPeerConnection settings object.