C# Класс Zazzles.Bus

An event driven IPC interface. Can also be used to send event only within the running process.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

Dispose() публичный статический Метод

public static Dispose ( ) : void
Результат void

Emit() публичный статический Метод

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
Результат void

GetCurrentMode() публичный статический Метод

public static GetCurrentMode ( ) : Mode
Результат Mode

SetMode() публичный статический Метод

Set the mode of the bus instance. Upon calling this method, the IPC interface will initialize.
public static SetMode ( Mode mode ) : void
mode Mode
Результат void

Subscribe() публичный статический Метод

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
Результат void

Unsubscribe() публичный статический Метод

Unregister an action from a channel
public static Unsubscribe ( Channel channel, Action action ) : void
channel Channel
action Action
Результат void