Upgrade a net.Socket
like object into a protocol specific connection object.
Event: connect
Emitted with a ctx
object containing the following.
ctx.auth
- Object
containing auth informationctx.auth.username
- Object
containing client usernamectx.auth.password
- Object
containing client passwordEmitted on successful connection (or reconnection).
Event: error
Emitted when a connection error has occurred.
Event: publish
Emitted with a ctx
object containing the following.
ctx.topic
- String
the topic the client would like to publish the message toctx.message
- String
or Buffer
the message to publishctx.options
- Object
protocol specific optionsEvent: subscribe
Emitted with a ctx
object containing the following.
ctx.topic
- String
the topic the client would like to publish the message toctx.options
- Object
protocol specific optionsEvent: unsubscribe
Emitted with a ctx
object containing the following.
String
the topic the client would like to unsubscribe from.Name | Type | Description |
---|---|---|
socket |
net.Socket
|
The |