Enable WebSockets (ws) protocol for lobby API

Enable WebSockets (ws) protocol for lobby API

Discuss development of lobby clients, server, autohosts and auto-download software.

Moderators: Moderators, Lobby Developers

Post Reply
Fuel
Posts: 114
Joined: 08 Jul 2006, 13:21

Enable WebSockets (ws) protocol for lobby API

Post by Fuel »

Hello,

I was thinking to create a HTML5 lobby.
Would it be possible to expose the API by the WebSockets (ws) protocol?

One possibility is using pywebsocket
http://www.tutorialspoint.com/html5/html5_websocket.htm

I am pretty sure there are options.

If you wonder, in order to access the filesystem for installed maps, settings, etc I am thinking about creating a webbrowser plugin to be able to access the local disk.
But this will be strictly for that, for UI and business logic, the HTML5 will be tool.
One option would be to do the API calls by the plugin also(such that WebSockets wont be necessary) but this means replicating the whole lobby API, which means alot of work.

Thanks!
F.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Enable WebSockets (ws) protocol for lobby API

Post by SinbadEV »

This is directed at other members not the original poster:

In before: WebLobby!!!

WebSockets is a completely different thing from having a java applet running in the background of a webpage... this poster is asking for something new that I think could be cool.
Fuel
Posts: 114
Joined: 08 Jul 2006, 13:21

Re: Enable WebSockets (ws) protocol for lobby API

Post by Fuel »

SinbadEV wrote:This is directed at other members not the original poster:

In before: WebLobby!!!

WebSockets is a completely different thing from having a java applet running in the background of a webpage... this poster is asking for something new that I think could be cool.
Yes, it has nothing to do with Java applets :)

I also think it would be pretty cool to expose it by WebSockets protocol.
Does anyone know what technologies are currently used to host the API on lobby.springrts.com ?
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Re: Enable WebSockets (ws) protocol for lobby API

Post by koshi »

Fuel wrote:what technologies
cleartext protocol over sockets
Fuel
Posts: 114
Joined: 08 Jul 2006, 13:21

Re: Enable WebSockets (ws) protocol for lobby API

Post by Fuel »

koshi wrote:
Fuel wrote:what technologies
cleartext protocol over sockets
What I meant was is it PHP or what is it

EDIT: I see there are two server implemenations: SpringLS(Java) and UberServer(phython)
Which one is used on the spring lobby server?
I am asking because I can do a small research to see how it could be easier to expose by WinSockets

EDIT2: based on what I found on forum, it looks like the server is using UberServer so phython
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Enable WebSockets (ws) protocol for lobby API

Post by hoijui »

i dont want to say you shoudl not, but i see no sense in doing this.
with this, i mena an other web-lobby, that uses some different technology for a subpart of its whole.
what is the real benefit?

implementing a whole different server protocol, just so you can do soemthign that is not needed, but "is cool" ...
i would not like to see dev time wasted on that.
not to mention that it introduces useless complexity.

if you want ot help spring, and it has to be HTML5, and you don;t know anythign else.. i am sure you can find plenty of suggestions, if you ask around here.
dansan
Server Owner & Developer
Posts: 1203
Joined: 29 May 2010, 23:40

Re: Enable WebSockets (ws) protocol for lobby API

Post by dansan »

If the lobby server would be accessible through websokets or xmlrpc then the existing weblobby wouldn't need the java applet - very desirable.

Anyone can just write a small proxy that translates lobby-proto <-> ws/xmlrpc and let it run on some server. It shouldn't be to hard to do it for the most basic commands, and would be a good test to see if it makes sense.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Enable WebSockets (ws) protocol for lobby API

Post by hoijui »

ahh yeah.. proxy server makes more sense. btw, the weblobby uses other java applets aswell.
YOU CAN'T GET RID IF OF IT, HA HAR!!!! iiiii hahahaaaa!
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Enable WebSockets (ws) protocol for lobby API

Post by Forboding Angel »

The reasoning would be that html5 implementation would be far superior in a lot of ways.
Fuel
Posts: 114
Joined: 08 Jul 2006, 13:21

Re: Enable WebSockets (ws) protocol for lobby API

Post by Fuel »

Besides the challenges of accessing the API(I also thought about having a proxy for websocket protocol), the main problem I see is the need of the HTML5 lobby to execute applications and access the local disk.

I haven't yet thought thoroughly about what features are required for lobby, but the most obvious are:
#1- lobby must start Spring.
this is possible I think by a file protocol. For example, Zero-K lobby uses spring:// protocol to launch itself. you can practically click in a web page and the web-browser will start the app associated with the protocol. the problem is that the protocol obviously needs to be installed. I am not sure how file protocols work on Linux and Mac for example, does anyone know?

#2- lobby must download the maps for Spring

Also, I can see several options how the HTML5 lobby would be embodied in:

#1- pure HTML5 web application(a website).
the nice thing is you could just open the webbrowser and navigate to a page and that would be your Spring lobby
the problem is starting Spring and local disk access would not be possible, as I mentioned above

#2- pure HTML5 web app(website) + a webbrowser plugin
the webbrowser plugin will expose the possibility to access operating system in any way(run Spring, download to a location, etc)
there are some challenges however making this secure as the plugin can be maliciously used by any web page to start Spring :D
also, a cross-browser and cross-platform plugin is not easy to write and maintain

#3- a native application which runs the HTML5 web application. it will be able to have unlimited access to the operating system

It would be nice to hear more ideas on this...

Thanks!
User avatar
Peet
Malcontent
Posts: 4383
Joined: 27 Feb 2006, 22:04

Re: Enable WebSockets (ws) protocol for lobby API

Post by Peet »

How many other (native) games are launched directly by a webpage?
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Enable WebSockets (ws) protocol for lobby API

Post by SinbadEV »

Peet wrote:How many other (native) games are launched directly by a webpage?
Actually a tonne of them, pretty much any "free to play" game that has a native client these days is launched from the browser.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Enable WebSockets (ws) protocol for lobby API

Post by aegis »

1. Open a socket on another port (maybe just continue the trend and use 8202+)
2. Add this port to startup options and help.
2. Modify Dispatcher to take multiple server sockets, each paired with a callback that creates and returns a new Client-compatible object.
3. Create a new Client-like class able to perform a websocket handshake, then wrap Send/Handle methods with a websocket frame writer/parser.
4. Add logic to reloading to support websocket clients.
5. When the server starts, pass the websocket server socket to Dispatcher as well as callbacks for both websocket and normal clients.
6. Test it.
Fuel
Posts: 114
Joined: 08 Jul 2006, 13:21

Re: Enable WebSockets (ws) protocol for lobby API

Post by Fuel »

LINK REMOVED

Tested with Chrome web-browser which supports web sockets.
Check it with a test user.
I implemented a very few basic features of the lobby

- connecting to server
- login user
- listing battles
- join a battle
- write messages written in the battle

You can check with another lobby that the user is connected.
Obviously do not use the same user, it won't work.

I am not a web developer so this is time consuming for me.
Would be great if someone would want to help
I just want to prove that this is really possible.

I have some ideas of how to make the web lobby open spring and even download maps, etc
Also, I have ideas how to make the lobby look much more appealing and simplistic. All current lobby implementations look complicated and cluttered.
Last edited by Fuel on 31 Jul 2012, 07:44, edited 1 time in total.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Enable WebSockets (ws) protocol for lobby API

Post by aegis »

This commit gives me working websocket clients:

https://github.com/lunixbochs/uberserve ... ad411bb6e8

You can test it using

Code: Select all

ws://bochs.info:8202/websocket
Post Reply

Return to “Lobby Clients & Server”