8

Is there something like socket.io (node.js) for C# ? I need a server version of it.

Thanks for your help!

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
Van Coding
  • 24,244
  • 24
  • 88
  • 132

6 Answers6

29

SignalR

Async signaling library for .NET to help build real-time, multi-user interactive web applications.

https://github.com/SignalR/SignalR

You can see a live example of it in play here http://jabbr.net/

You will need IIS 8.0 to get web sockets, it uses long-polling on IIS 7.

I think they may be working on using https://github.com/davidfowl/Fleck and https://github.com/davidfowl/SignalR.Fleck to show how you can use Fleck web socket server with SignalR

superlogical
  • 14,332
  • 9
  • 66
  • 76
8

.NET has a number of ways to implement a 100% async design similar to node.js.

See Socket's BeginSend/EndSend and higher-performance SendAsync, or Stream's BeginRead/BeginWrite methods. These are all very similar to node.js.

C# 5.0 is bringing in a new async design with language support that will be a lot easier to use than those above. You can play around with a beta of it in the Async CTP.

Cory Nelson
  • 29,236
  • 5
  • 72
  • 110
  • The delegates and new C# Async is not same as the framework I mentioned. Those frameworks uses a single non blocking thread on the other hand in .NET each client is handled by a separate thread and this is the fundamental difference. – Kazi Manzur Rashid May 10 '11 at 15:21
  • 1
    Oops, I forgot that node.js uses a single thread. However, .NET does not handle each client on a separate thread -- it uses a thread pool and never blocks. If you lock when accessing global state you should be fine. Also, the C# Async CTP uses whatever execution context you start the I/O in -- if your context is single-threaded, it will only use that single thread for all your connections. – Cory Nelson May 10 '11 at 16:21
4

Just saw a video from mix11, where they talked about Manos de Mono. It is a C# framework modeled after tornadoweb with inspiration from frameworks like node.js.

https://github.com/jacksonh/manos

Samg
  • 638
  • 1
  • 5
  • 17
3

There is also another library called XSockets

http://xsockets.net/

They also include a fallback for browsers that don't implement the WebSocket protocol Fallback via Flash

superlogical
  • 14,332
  • 9
  • 66
  • 76
0

This has just been released, documentation and examples are on the way!

https://github.com/kayak/kayak https://groups.google.com/forum/#!topic/kayak-http/LXS_xh0qurM

You may also want to check out http://superwebsocket.codeplex.com/

I'm not sure if it uses a single thread or thread-pool though.. But that will only be a problem once you want to have 1000s of connections at any one time.

superlogical
  • 14,332
  • 9
  • 66
  • 76
-3

I do not think there is any framework in .NET which has evented IO support like node.js or ruby's EventMachine or python twisted :-(.

Kazi Manzur Rashid
  • 1,544
  • 13
  • 14
  • 3
    @kazimanzurrashid : Van Coding was asking of an equivalent to socket.io, not node.js... – billy Jan 21 '13 at 13:56