import PubSub from '@mobilizing/library/js/Mobilizing/net/PubSub.js'
PubSub
PubSub is a publish-subscribe messaging system based on socket.io It allows simple socket communication between different clients An runing instance of MobilizingServer is required to make this work
Example:
//TODO
Constructor Summary
Public Constructor | ||
public | constructor(params: Object) |
Member Summary
Public Members | ||
public | autoConnect: * | |
public | events: * | |
public | id: * | |
public | socket: * | |
public | subscriptions: {} | |
public | url: * |
Method Summary
Public Methods | ||
public | close() Close the socket connection | |
public | getID(): * Get the socket id | |
public | Open the socket connection | |
public | Publish a message to a specific channel | |
public | Subscribe for messages from a specific channel | |
public | unsubscribe(channel: String, callback: Function) Unsubscribe for messages from a specific channel |
Public Members
public autoConnect: * source
public events: * source
public id: * source
public socket: * source
public subscriptions: {} source
public url: * source
Public Methods
public close() source
Close the socket connection
public open(url: String) source
Open the socket connection
Params:
Name | Type | Attribute | Description |
url | String | URL of the server on which the MobilizingServer instance is running |
public publish(channel: String, message: Mixed) source
Publish a message to a specific channel
Params:
Name | Type | Attribute | Description |
channel | String | The channel on which to publish the message | |
message | Mixed | The message to publish |