Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: SignalR in ClearScript

$
0
0
I've not dug into the details but I don't believe SignalR needs the DOM for anything however the JavaScript SignalR client is based upon jQuery. In fact it is in the file name (jquery.signalR-2.1.1.js). And so when I try to execute jQuery followed by the SignalR script it fails because jQuery references the window object from the web API provided by the browser. I don't know what else jQuery needs but it seems to be the sticking point when it comes to SignalR without outside of a browser.

There is a Nodejs SignalR client script that does not require jQuery but it only supports the websockets transport and that doesn't work when the SignalR server is running on any Windows OS below Windows 8 or Server 2012. I actually got this part installed and working to the point that the server sent back a message saying it did not support websockets. After a little reasearch I learned about the Windows OS limitations with websockets.

I think I have found an alternate solution. I created my own .NET class that handles the client side SignalR interface. I then add this type to the V8 engine. The JavaScript then interfaces with SignalR through my .NET host environment. It was a little tricky getting all the async callbacks working but the answers you have for other discussion threads gave me what I needed to get it working. Its actually pretty cool once it gets working. Data starts pouring in very rapidly in my test environment - multiple updates every second - and it seems to be working well enough.

Right now I am just prototyping and figuring out how to solve some of these interface problems and marshalling data back and forth between ClearScript and Host. I'm nearly done with that and then I have to design the applications structure. A user will have mutiple instances of a v8Engine running at the same time and each one will have a separate SignalR connection with real-time (every half second) data updates. I'm curious to see how well it performs when it is loaded up with 10 scripts and a thousand SignalR data subscriptions. Is there anything you can think of that I should look out for?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images