[plugin] SockJS

Post your completed addons to share with the community

Post » Fri Jun 14, 2013 4:26 pm



SockJS



Sockjs can be used as an alternative to official websocket plugin or socket.io.

As we wait for a Socket.io 1.0 I've decided to put my efforts on SockJS plugin. Because of the design of sockjs library, the plugin is almost identical to the official websocket plugin, but enables you to use all advantages of sockjs. There's more work to be done, if you are using this plugin, please report back on how did it go.

From the official SockJS readme:

SockJS is a browser JavaScript library that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.

Under the hood SockJS tries to use native WebSockets first. If that fails it can use a variety of browser-specific transport protocols and presents them through WebSocket-like abstractions.

SockJS is intended to work for all modern browsers and in environments which don't support WebSocket protcol, for example behind restrictive corporate proxies.


You can find a simple test demo here, and the plugin here.

If you find any bugs, or have some ideas on how to improve this plugin, please head over here

For more info on SockJS, check here.

Cheers!                  JohnnySheffield2013-06-15 15:06:56
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,662

Post » Fri Jun 14, 2013 7:31 pm

Isn't better than Bottleneck?
B
96
S
34
G
29
Posts: 3,138
Reputation: 28,234

Post » Sat Jun 15, 2013 12:07 am

Bottleneck I believe is Rexrainbows's(I could be wrong on who's) server technology. Where as sockjs is a transport wrapper between client and server. sockjs is a move to replace socket.io who's current developement has slowed down.

So as an example if a browser(likely mobile) can't use websocket sockjs will revert to making calls along the lines of AJAX or essentiaclly HTTP://whatever. and recieve under the same line.

It's really a good idea :)

Sounds good @JohnnySheffield looking forward to seeing where this goes :)
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Mon Jun 17, 2013 5:42 am

@jayderyu

Yes, Bottleneck is a server made by me. It used node.js + socket.io.
B
107
S
25
G
231
Posts: 4,361
Reputation: 131,412

Post » Thu Jul 04, 2013 1:03 am

WoW, just, WoW!

Best wishes for this initiative.
B
7
S
3
G
1
Posts: 154
Reputation: 1,812

Post » Fri Aug 09, 2013 3:07 am

Hey Johnny, I'm not sure how actively you are working on this plugin but I think we should talk and see how we can further move this plugin.

In anycase, I've been tinkering around with multiplayer functionality and I've tested just about everything (to no avail), until I found SockJS. I was finally able to get some sort of real time data transferring through a NodeJS server (hosted at Nodejitsu).

And to my point... I've found a small bug that I'm not sure if it has to do with the sockjs plugin or not. Essentially, what happens is:

On SockJS even "On Message": when I added the System Trigger once condition to it, the sockjs doesn't recognize this and still runs the loop multiple times, instead of just once.

Let me know if you know anything about this, thanks a lot!
B
3
Posts: 9
Reputation: 568

Post » Fri Aug 09, 2013 8:26 am

I actually found a way around this. For the purposes of my game it should work.

If I'm able to complete the basic concepts of my game with sockjs in multiplayer, I'll definitely let you know about it.
B
3
Posts: 9
Reputation: 568

Post » Sat Nov 07, 2015 4:27 pm

hi hello i have try your plugin and i have put the server file in my server but wen i try to connect nothing happen.
Some One Can Give me a help with please
B
3
Posts: 8
Reputation: 218


Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest