简体   繁体   中英

SocketIO4Net.Client subscribing to a channel

I'd like to subscribe to a socket.io channel from a client that's using SocketIO4Net.Client

What is the best way to do that, given that there is no subscribe operation or subscribe message type implemented in the library?

There are 3 basic ways you can subscribe to a channel/room from within SocketIO4Net.Client:

[From the doc's]

Registering for Socket.IO event messages in the .net client can be done several ways:

Using an Action delegate Using an Action delegate with anonymous methods Using a lambda expression to an Action delegate instance in the .On(eventName, Action) method (preferred). By default, all messages received are exposed through the Message event. Event messages registered via the .On() method will skip the Message event notification.

The general method is as:

socket.On("news", (data) =>
{
    var raw = data.RawMessage();                            
});

There is a fair amout of [documentation][1]

[1]: http://socketio4net.codeplex.com/documentation , is there something in particular that isn't covered (will add if so)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM