Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (20 sloc) 1.53 KB

what it does?
'takes' over socket.io client side emitting and transfers it using jQuery $.ajax get jsonp

how?
install oi.tekcos using npm

npm install -g oi.tekcos

server side usage:

// returns the same object like require('socket.io').listen(1337)  
io = require('oi.tekcos').listen(1337)  

client side usage:

<script src="/socket.io/socket.io.js"></script>  
<script src="/oi.tekcos/oi.tekcos.js"></script>  
<script>
    // just like socket.io... so readup at http://socket.io/  
    var socket = io.connect('http://localhost:1337');  
</script>  
  • yes, include original socket.io.js, if you wont include oi.tekcos.js in the client side the server side wont be affected
  • oi.tekcos uses $.ajax (using jQuery. dont care about other libs) to preform the jsonp-get requests

why you ask?
because already wrote a project using socket.io (and loving it!) but for my misfourten the mobile client that my organization uses is a lame Nokia E72 w/ SymbianOS, that from some reason stopped reciving and emiting events after a couple of client side emits (client emits server). i noticed that when i only recive events (server emiting client) it works fine. so i did this workaround using jQuery $.ajax call that maps to an express server. the server get those 'get jsonp' requests and then routes it to the socket.io interface and returns a response to the client (a callback function, just like the socket.io api) . yes. its shite... but i tried to be as clean as possible.

more info will come in the future...