View topic - Enable WebSockets (ws) protocol for lobby API



All times are UTC + 1 hour


Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: 25 Jul 2012, 13:45 

Joined: 08 Jul 2006, 12:21
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.


Top
 Offline Profile  
 
PostPosted: 25 Jul 2012, 13:51 
User avatar

Joined: 02 May 2005, 02:56
Location: Canada
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.


Top
 Offline Profile  
 
PostPosted: 25 Jul 2012, 14:08 

Joined: 08 Jul 2006, 12:21
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 ?


Top
 Offline Profile  
 
PostPosted: 25 Jul 2012, 14:14 
Lobby Developer
User avatar

Joined: 14 Aug 2007, 15:15
Fuel wrote:
what technologies
cleartext protocol over sockets


Top
 Offline Profile  
 
PostPosted: 25 Jul 2012, 14:16 

Joined: 08 Jul 2006, 12:21
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


Top
 Offline Profile  
 
PostPosted: 25 Jul 2012, 22:25 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.


Top
 Offline Profile  
 
PostPosted: 25 Jul 2012, 22:54 

Joined: 29 May 2010, 22:40
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.


Top
 Offline Profile  
 
PostPosted: 26 Jul 2012, 10:37 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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!


Top
 Offline Profile  
 
PostPosted: 26 Jul 2012, 14:23 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
The reasoning would be that html5 implementation would be far superior in a lot of ways.


Top
 Offline Profile  
 
PostPosted: 27 Jul 2012, 09:52 

Joined: 08 Jul 2006, 12:21
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!


Top
 Offline Profile  
 
PostPosted: 27 Jul 2012, 19:26 
Malcontent
User avatar

Joined: 27 Feb 2006, 22:04
Location: Hurrrrrr.
How many other (native) games are launched directly by a webpage?


Top
 Offline Profile  
 
PostPosted: 27 Jul 2012, 20:12 
User avatar

Joined: 02 May 2005, 02:56
Location: Canada
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.


Top
 Offline Profile  
 
PostPosted: 29 Jul 2012, 18:47 
Redacted
User avatar

Joined: 11 Jul 2007, 16:47
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.


Top
 Offline Profile  
 
PostPosted: 29 Jul 2012, 23:45 

Joined: 08 Jul 2006, 12:21
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, 06:44, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 30 Jul 2012, 01:04 
Redacted
User avatar

Joined: 11 Jul 2007, 16:47
This commit gives me working websocket clients:

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

You can test it using
Code:
ws://bochs.info:8202/websocket


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.