emoon / rocket

GNU Rocket Git mirror

Home Page:rocket.sf.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for jsRocket

helgrima opened this issue · comments

Should RocketEditor support jsRocket? I have not managed to get it working. I am using http://plnkr.co/edit/gPb2rYwmydisTmpg5p7g?p=preview as a base for my work.

Chrome and Firefox are throwing following error: failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET in syncdeviceclient.js at JSRocket.SyncDeviceClient function which creates WebSocket connection to RocketEditor.

My assumption is that there something in WebSocket protocol which is not taken into account, as RocketEditor works fine with bass_example.exe. Although this problem persist with all editors i have encountered. Or am I just missing something.

I am using precompiled binaries found here. https://dl.dropbox.com/u/5205843/RocketEditor1.0-win32.zip

Hi you can try this latest version here https://dl.dropboxusercontent.com/u/5205843/RocketEditor1.2beta-Win.zip

If jsRocket would use the exact same network code to talk to the RocketEditor it should work just fine. I would assume there something extra that needs to be taken into account when talking to the WebSocket and that is why it doesn't work?

It seems that version 1.2beta does not work either. And I am quite sure you are right about that talking to WebSocket is somehow different. I downloaded this example http://patp.at/xmas/, written by mog, same person who wrote jsRocket, and seems that it is not working either. Maybe I should contact mog for further information.

EDIT
Now I realized that there is precompiled binaries for original rocket editor and it is shipped with Qt5WebSockets.dll. So there must be something different in WebSockets that in normal sockets. But still I have no luck with this either, although it gives me different error message: failed: Connection closed before receiving a handshake response

But I am going to leave this issue open as request for js support.

Ok. It might be that you need to "talk" some extra with WebSockets (ie doing some handshake) in order for it to work. I don't think it would be hard to add but:

  1. In order for it to work I would need to know the exact steps so I can tell the different when connecting to a regular socket.

  2. Related to 1 I don't think that the sync lib has some versioning so it might need that it needs to be updated to support this in a good way. I'm not sure though.

If you are able to figure out the exact steps I would need to take in order to get this to work I would be happy to look into it and also if you know a good way I could test this in an easy fashion.

Using this piece of python software(https://docs.python.org/2/library/socketserver.html#socketserver-tcpserver-example) I realized that WebSocket is quite different than normal socket.

This is example running python software and basic_example.exe provided RocketEditor:
127.0.0.1 wrote:
hello, synctracker!

And here is example running python software and jsRocket:
127.0.0.1 wrote:
GET / HTTP/1.1
Host: localhost:1338
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: http://localhost:8000
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8,fi;q=0.6
Cookie: .AspNetCore.Antiforgery.6MH6-wyOb4k=CfDJ8N2YzDDOIMZEhvw0B14lowJbHNiJ16ddBKG3bL0rxsii0BuCdCmBVu6FP-hXFkHiA2NwxA0nHnWR-2o4jPoetpqEEcnS27VNOTJHYqeexLAyufw2wGsYWVP_vDv2v3EobS9swIKac3RWlrgdptIZSrE; CP.mode=B; size=4
Sec-WebSocket-Key: gcgq0V69S1CVoWIc80RGRg==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

That must be the handshaking, which for me looks similar to HTTP request. Maybe RocketEditor should response to that message in some way that WebSocket understands and after that normal socket communication can go on. That is what I think.

Yeah I'm pretty sure it would get confused with something like that as it isn't expected. One would have to look at exactly what would be needed to support that then.

I am under impression that original rocket editor is using Qt WebSocket library. Is using third party libraries in your project suitable? Of course I could give it a shot and try to implement it, but I have no time until next year.

Using a third party library is ok as long as it's in C and not too bloated. There is a bunch of them here already https://github.com/emoon/rocket/tree/master/external that I use. It would be great if you could give it a shot :)