Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

implement signalR without jquery

is it possible to implement SignalR without the use of Jquery. I want to create a module for Titanium, but I don't know how dependent SignalR is on the DOM. Is jQuery used just for the ajax request? how hard do you think this would be?

like image 543
Ryan Avatar asked May 30 '12 08:05

Ryan


1 Answers

Um its not impossible but it'll be abit of work. you will basicly need to re-write all jquery syntax ($...) in

Jquery.signalR.js

as regual javascript. Also you will only be able to do low level connections as the "hub" model also requires jquery.

You will probably need to include JSON.js so you can make your ajax call like this.

var the_object = {}; 
var http_request = new XMLHttpRequest();
http_request.open( "POST", url + "/negotiate, true );
...
http_request.onreadystatechange = function () {
    if ( http_request.readyState == 4 && http_request.status == 200 ) {
            the_object = JSON.parse( http_request.responseText );
        }
};
http_request.send(null);
like image 52
Elliot Wood Avatar answered Oct 28 '22 17:10

Elliot Wood