8

I am in great dilemma as to use html5 websockets or signalR for a chat we are going to integrate into our asp.net mvc3 application

My dilemmas
1.Why to use signalR if it implements longpolling?
2.Isnt longpolling bad?
3.websockets and longpolling completely different?
4.Only IIS8 supports websockets?
5.Can i save the chat data into SQL database using Html5 websockets?
6.Isnt there a workaround to make websockets work on IIS7 and higher versions(i will be using chrome browser only)
Thanks for bearing with me

bhargav
  • 619
  • 2
  • 14
  • 30

4 Answers4

11
  1. Why to use signalR if it implements longpolling?

    Answer: to enable support for old browsers or to have a higher level of abstraction over data transfer implementation details. If you definitely will use the version of chrome that has a websockets support - use websockets (good explanation here).

  2. Isnt longpolling bad?

    Answer: actually it is not the best (see link above), but better than nothing for old browsers.

  3. websockets and longpolling completely different?

    Answer: they are quite different (again, see answer above), but there is smth in common for them (they both require a connection).

  4. Only IIS8 supports websockets?

    Answer: if you want to use pure .NET framework - yes, only IIS 8, and .NET 4.5. But you can use another websockets server (see workaround below).

  5. Can i save the chat data into SQL database using Html5 websockets?

    Answer: websockets is only a protocol to send data, so literally using it you cannot perform any action except of transferring data. However you could, say, have a token that will be send to server and will mean "save all previous data to DB". Or you could have more complex scenarios based on different kind of messages like inplemented in socket.io for node.js.

  6. Isnt there a workaround to make websockets work on IIS7 and higher versions(i will be using chrome browser only)

    Answer - yes, just do not use IIS, but another websockets server implementation (e.g. Fleck - has nice support for "old" browsers supporting webseckets) and run it alongside IIS as a separate process for example.

Community
  • 1
  • 1
Pavel K
  • 3,541
  • 2
  • 29
  • 44
7

SignalR can support websockets if IIS and your browser support this, if not it uses longpolling. Using SignalR will save you a lot of time reinventing the wheel, they have proven that you can create a good chat website with it.

Wim
  • 1,967
  • 11
  • 19
  • its good they support websockets..but most of the cases IIS and browser doesnt seem to fit with websockets so most of the cases it will be longpolling... – bhargav Feb 16 '12 at 09:03
  • so instead of having long polling in most of the cases isnt there a workaround to make the websockets work on all IIS and chrome only...? Yes i have seen the demo webchat here http://jabbr.net/#/rooms/Lobby – bhargav Feb 16 '12 at 09:07
  • I don't think there is a workaround to make websockets work. Support for websockets will grow rapidly when iis8 is released. – Wim Feb 16 '12 at 10:51
0

enter image description here

Hope it will solve all your queries.

Mohit Verma
  • 5,140
  • 2
  • 12
  • 27
-3

4. Only IIS8 supports websockets?

SignalR supports IE < 8 with Json2.js. Just get it with Nuget install-package json2

Make sure you add a reference to json2.js BEFORE signalR.js

ShyGuy82
  • 115
  • 2
  • 6