Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from websockets to see #39

Open
TGRHavoc opened this issue Mar 7, 2020 · 3 comments
Open

Move from websockets to see #39

TGRHavoc opened this issue Mar 7, 2020 · 3 comments

Comments

@TGRHavoc
Copy link
Owner

TGRHavoc commented Mar 7, 2020

Websockets are probably not the best technology to use for LiveMap. We don't send any data back from the client so, SSE is looking more promising.

Plus, if we start to use SSE's we can take advantage of FiveM's reverse proxy and move their installations to Ssl-enabled websites.

Obviously this would need a re-write of the interface.
It wouldn't be breaking on the resource side (no changes to the API) . Maybe would on the interface)(as we're scrapping websockets all together which, might be relied on by custom scripts).

@TGRHavoc
Copy link
Owner Author

Had a quick try at implementing it with the current code base. Then, tried to do it with Lua but... No success.
My attempt is over at https://github.com/TGRHavoc/live_map/tree/failed/sse and doesn't work. It's just there to show that I am actively working on trying to find a solution.

I've tried to explain to the best of my ability what I think is wrong in commit 735df7b.

In the mean time, I will look at re-writing the resource in C#. More specifically, dotnet. Hopefully I can get something working kind of like webadmin. Afaik, this resource does SSE successfully with an /events endpoint.

So, more research is required and, possibly, a rewrite is needed.

Note: The server-side events and stuff will all still be the same. This will not be a "breaking" change to others depending on the resource. It will however, need another version of the interface to work... Which, I will try and do as simply as possible. Hopefully it's just a matter of swicthing from Websockets to the EventSource API.
God, I hope it's that simple.

@TGRHavoc
Copy link
Owner Author

TGRHavoc commented Apr 16, 2020

Pretty sure this is not possible with the current implementation of FiveM. For some reason the headers don't seem to be sent to the client which, causes browsers' requests to hang until the connection is closed.

I've got a C# implementation over on commit 208bd3b.

If anyone knows if any way of getting SSE to work on FiveM, do contact me on here.

As for now, going to stop working on trying to get SSE working... Good bye dreams of having a secure LiveMap out-of-the-box 😞

@TGRHavoc TGRHavoc removed their assignment May 4, 2021
@robertne13
Copy link

is there any simple implementation to get the websocket offline and read the coords of every player from a mysql database for example? that server updates every x minutes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants