A C# implementation of socket.io-emitter
socket.io provides a hook point to easily allow you to emit events to browsers from anywhere so socket.io-csharp-emitter communicates with socket.io servers through redis
PM> Install-Package SocketIO.Emitter IEmitter io = new Emitter(new EmitterOptions
{
Host = "localhost",
Port = 6379
});
io.Emit("news","Hello from c# emitter");The following options are allowed:
Key: the name of the key to pub/sub events on as prefix (socket.io)Host: host to connect to redis on (localhost)Port: port to connect to redis on (6379)Version: Version of socket IO (EmitterOptions.EVersion.V0_9_9)
NB : If you use a version of socket.io >= 1.4.4 change property Version to EmitterOptions.EVersion.V1_4_4.
If you don't want to supply a redis client object, and want
socket.io-csharp-emitter to intiialize one for you, make sure to supply the
host and port options.
Specifies a specific room that you want to emit to.
IEmitter io = new Emitter(new EmitterOptions
{
Host = "localhost",
Port = 6379
});
io.In("room-name").Emit("news","Hello from c# emitter"); IEmitter io = new Emitter(new EmitterOptions
{
Host = "localhost",
Port = 6379
});
io.To("room-name").Emit("news","Hello from c# emitter");Specifies a specific namespace that you want to emit to.
IEmitter io = new Emitter(new EmitterOptions
{
Host = "localhost",
Port = 6379
});
io.Of("/nsp").In("room-name").Emit("news","Hello from c# emitter");MIT
- StackExchange.Redis by StackExchange
- Msgpack.Cli by Yusuke Fujiwara (@yfakariya)