Mono module implementation for web sockets.
"webSockets": {
"module": "github/jillix/web-sockets/MODULE_VERSION"
, "roles": MONO_ROLES
, "config": {
"binds": BIND_CONFIGURATION // optional
, "listen": EVENT_CONFIGURATION // optional
}
, "operations": {
"init": {
"roles": MONO_ROLES
, "params": []
}
}
},
Inits the socket in the page. This is called automatically!
-
options
: an object containing the following fields:force
: if the websocket is already inited andforce
istrue
, the websocket will be reinitedlog
: log level passed to socket.io
-
callback
: a function that is called when the socket it inited
Emits an event and data to the server
-
options
: an object containing- event: the event name
- data: the data that goes to server side
-
callback
: a function that is passed too to the emit function from socket emit function
Listen an event that comes from the server
options
: an object containingevent
: the event name
callback: a function that is passed too to the on function
Call the sendMessage from the server
message
: an object containingtype
(string): client, session, group, or allsession
(session id): which clinet should recive this message; all if undefineddata
(object)
Emits a global event using M.emit()
options
:event
: the event name that is emiteddata
: data to be emited
The module listens for the following server events:
sockets.init
sockets.emit
sockets.listen
sockets.send
- transferred the module to the new jxMono organization
- updated Bind to
v0.4.0
, Events tov0.4.0
- Use
location.host
instead oflocation.origin
(IE compatibility, #5) - Update to Bind v0.3.1
- Minor syntax changes
- New owner (@jillix)
- Updated deps
- Fixed bugs in
clientEmit
method - Fixed #3: send a refresh signal on the client
- Fixed #2: set the debug mode (default:
false
) - Syntax changes
- Comments
- Additional checks for preventing errors
- Upgrade to Events v0.1.8 and Bind v0.2.1
- Emit a global event on the server side using functions from the client side.
- Added more public functions.
- Removed obsolete Mono operations. The only module operation is
init()
.
- TODO
- Initial version.