K Scott and and Jon talk to  about Uffe Bjorklund and Magnus Thor about xSockets, a free framework for Web Socket and WebRTC communications.

Download / Listen:

Herding Code 179: xSockets with Uffe Bjorklund and Magnus Thor

Show Notes:

  • Intro
    • (00:30) Uffe and Magnus introduce themselves.
    • (00:50) K Scott asks about how xSockets got started, and what problem it solves.
    • (02:05) Jon asks if xSockets is a business or a project. Magnus says it’s now a full-time business – they’ve been working on xSockets for four years, but they’ve gone full-time earlier this year. Uffe points out that while it’s supported by a full time business, xSockets is free to use.
  • xSockets compared to SignalR, unique xSockets features
    • (02:57) K Scott asks how xSockets compares with SignalR. Magnus says they’ve been working on this for 4 years and mentions some differences. Uffe compliments the SignalR project and community, then points out that one important difference is that xSockets is stateful, whereas SignalR isn’t.
    • (04:54) Jon talks about the different approaches towards stateful controllers, and that it seems that stateful controllers could simplify things. Uffe describes some advantages, like filtering where you send messages dynamically with lambda expressions (a lot more control than groups in SignalR).
    • (06:10) Magnus talks about the JavaScript proxy in the xSockets which also is able to interact with state on the server.
    • (07:09) K Scott asks about other differences. Uffe says that xSockets is very portable – running on IIS, OWIN, Azure, Amazon, a Raspberry Pi, even your cellphone if you want. It runs on anything that runs .NET 4 or Mono, and they’ve had reports on it running a wide variety of hardware.
    • (07:52) Jon says he’s heard of people using local servers for desktop applications. Uffe says they have people in Russia doing that with xSockets.
    • (08:20) Magnus says that they have support for long-running controllers.
    • (08:50) Uffe says they’ve got a plugin framework. It was originally built on MEF, but they’ve recently rewritten it to remove the MEF dependency. You can drop an assembly in the xSockets  folder and it will be picked up. Jon says it looks pretty similar to MEF; Uffe says he loves MEF and kept it pretty similar.
    • (09:55) K Scott says it feels very similar to ASP.NET MVC, in that there’s a controller base class that you extend.
    • (11:00) K Scott asks if there’s a routing mechanism. Uffe describes the extension methods that allow sending messages as well as using the routing system.
    • 11:52 Jon says he noticed the generic controller which works as a message dispatcher. Uffe describes how it works as a smart dispatcher, which will only dispatch messages to people who are subscribed. This is useful to people who are familiar with JavaScript; they can do pretty advanced stuff without needing to write any server-side code.
    • (12:56) Magnus describes the channel system, which allows for some complex, private communications without requiring server-side code.
  • Web Sockets protocol
    • (14:02) K Scott remarks that the Web Sockets protocol has changed quite a bit over the years. Magnus says that it was very difficult earlier, but has stablilized.
    • (15:02) K Scott asks if there’s a test suite for Web Sockets available. Uffe says there are some, but all have problems. The xSockets team uses their own testing system.
    • (16:00) Jon asks if the Web Sockets API is difficult to use. Magnus says the two first versions were pretty easy, but the RFC introduced some more difficult concepts like control frames and continuous frames.  There are a lot of solutions on GitHub and CodePlex for dealing with protocol stuff.
  • Web RTC
    • (16:40) Jon asks about Web RTC support. Magnus says Web RTC enables realtime communications in the browser using peer-to-peer communication without requiring a server or middleman once the communications are established.
    • (18:47) K Scott asks if the Web RTC communications are TCP or UDP. Magnus says it’s UDP so it can be unreliable. There’s a NuGet package with a full sample showing how it works.
    • (20:00) K Scott asks about the processing pipeline. Uffe describes the Rewritable attribute – you can use that to override anything in the pipeline.
  • Fallback and pipeline
    • (21:05) Jon asks about fallback support for older browsers. Magnus says there’s long-polling support based on MVC; they’re going to replace that with a Web API based solution. Uffe says it’s easy to implement; just add a JavaScript reference. He also says there’s no MVC dependency in xSockets, so you can use it without MVC if you want.
  • External API
    • (22:25) K Scott asks about the external API. Uffe says it should probably called something clearer – it’s a client that can be used in any C# code, as well as PowerShell and even compiled stored procedures in SQL Server. Uffe describes some of the ways he’s seen it used.
  • Crazy things people have been doing with xSockets
    • (24:24) K Scott asks if there’s anything crazy they’ve seen people do with xSockets. Magnus talks about a microscope control system used in Jamaica. Uffe talks about a realtime water monitoring system in Dubai running in C# 2.0 on Windows CE. They’re now able to control the water system via a web page, which replaced the need for an entire water monitoring facility.
    • (27:32) Magnus talks about a Fruit Ninja like game using xSockets, HTML5 canvas and Kinect. That lead to a job building a virtual lobby, which they completed in 10 days.
    • (28:18) K Scott asks about authentication and authorization with xSockets.
  • Final questions, Samples and Videos
    • (29:08) K Scott takes a question from Twitter about what they think about OWIN. Magnus says they support it and it seems like a good idea, but he can’t
    • (29:42) K Scott asks about the While You Were Gone example. Uffe says this is a queue system that handles offline messages, so if you’re disconnected for a period of time it will deliver the messages when you reconnect.
    • (31:12) K Scott asks if there’s anything that may have been missed. Uffe talks about clustered servers – they’re all siblings which communicate peer-to-peer.
    • (32:48) Uffe talks about some upcoming travel they’ve got later this year for Desert Code Camp in November and possibly NDC London in December.
    • (33:22) Jon talks about the best way for people to get started. Magnus recommends the videos on xSockets.net.

Show Links:

Bookmark and Share