C# Class Zazzles.Bus

An event driven IPC interface. Can also be used to send event only within the running process.
Afficher le fichier Open project: FOGProject/zazzles Class Usage Examples

Méthodes publiques

Méthode Description
Dispose ( ) : void
Emit ( Channel channel, Newtonsoft.Json.Linq.JObject data, bool global = false ) : void

Emit a message to all listeners

GetCurrentMode ( ) : Mode
SetMode ( Mode mode ) : void

Set the mode of the bus instance. Upon calling this method, the IPC interface will initialize.

Subscribe ( Channel channel, Action action ) : void

Register an action with a channel. When a message is recieved on this channel, the method will be called.

Unsubscribe ( Channel channel, Action action ) : void

Unregister an action from a channel

Private Methods

Méthode Description
Emit ( Channel channel, string data, bool global = false ) : void

Emit a message to all listeners

EmitMessageFromSocket ( string message ) : void

Parse a message recieved in the socket and emit it to channels confined in its instance

Initializesocket ( ) : void

Initiate the socket that connects to all other FOG bus instances It MUST be assumed that this socket is compromised Do NOT send security relevant data across it

SendMessage ( string msg ) : void

Send a message to other bus instances

client_connect ( WebSocketSession clientSession ) : void
socket_RecieveMessage ( WebSocketSession session, string value ) : void

Called when the socket client recieves a message

socket_RecieveMessage ( object sender, WebSocket4Net.MessageReceivedEventArgs messageReceivedEventArgs ) : void

Called when the server socket recieves a message It will replay the message to all other instances, including the original sender unless told otherwise

Method Details

Dispose() public static méthode

public static Dispose ( ) : void
Résultat void

Emit() public static méthode

Emit a message to all listeners
public static Emit ( Channel channel, Newtonsoft.Json.Linq.JObject data, bool global = false ) : void
channel Channel The channel to emit on
data Newtonsoft.Json.Linq.JObject The data to send
global bool Should the data be sent to other processes
Résultat void

GetCurrentMode() public static méthode

public static GetCurrentMode ( ) : Mode
Résultat Mode

SetMode() public static méthode

Set the mode of the bus instance. Upon calling this method, the IPC interface will initialize.
public static SetMode ( Mode mode ) : void
mode Mode
Résultat void

Subscribe() public static méthode

Register an action with a channel. When a message is recieved on this channel, the method will be called.
public static Subscribe ( Channel channel, Action action ) : void
channel Channel The channel to register within
action Action The action (method) to register
Résultat void

Unsubscribe() public static méthode

Unregister an action from a channel
public static Unsubscribe ( Channel channel, Action action ) : void
channel Channel
action Action
Résultat void