NorthstarLauncher icon indicating copy to clipboard operation
NorthstarLauncher copied to clipboard

Potentially add Websocket support for Squirrel mods

Open Erlite opened this issue 2 years ago • 9 comments

Hey!

This issue is here to discuss the potential addition of websocket support in Northstar, which would let you make websocket connections in Squirrel mods.

If this interests you, please leave a comment below explaining your use cases and potential requirements.

Erlite avatar Dec 17 '22 00:12 Erlite

My main use case would be for my discord bridge rewrite. I may find others too.

I'd need to have two way communication with an external server, and be able to encode / decide json on the squirrel side in order to send various gave events and act on messages from the server.

HeatherComputer avatar Dec 17 '22 09:12 HeatherComputer

I'm for adding a libcurl-based (the other ones have varying levels of dirtiness/bloat/non-compliance/bugginess) websocket client personally. I'd personally use it for debugging FD and remote control of dynamically managed instances.

pg9182 avatar Dec 19 '22 18:12 pg9182

Overall, from all the useful response on the Discord server, I guess modders just need a websocket client, so that would easily be added.

Erlite avatar Dec 20 '22 18:12 Erlite

I would be interested in Websocket to drop my forked version of Northstar to use my Telemetry system.

I am not to well versed in C++ and the websocket libraries. Would it be possible for this integration to have the ability to add custom HTTP headers for authentication to the opening handshake?

Neoministein avatar Dec 20 '22 22:12 Neoministein

I'll probably have some fun doing that this weekend.

I am not to well versed in C++ and the websocket libraries. Would it be possible for this integration to have the ability to add custom HTTP headers for authentication to the opening handshake?

Very likely yes.

Erlite avatar Dec 23 '22 19:12 Erlite

I've been told you could use websockets to make a non-interacting coop system where each player runs in sp and just their position is transmitted to the other player as a sort of live ghost replay, which could be very cool for speedrun tournaments imo

zweek avatar Jan 05 '23 16:01 zweek

I've been told you could use websockets to make a non-interacting coop system where each player runs in sp and just their position is transmitted to the other player as a sort of live ghost replay, which could be very cool for speedrun tournaments imo

Note that such a speedrun tournament (Mach 3 March) will happen in a bit less than two months. So for anyone contemplating implementing this, getting a PoC working a while beforehand might be desirable ;)

GeckoEidechse avatar Jan 05 '23 17:01 GeckoEidechse

@Fuchsiano and I implemented a basic websocket using the Plugin v2 API. I bet it's not the best implementation but it's at least better than nothing.

It can connect, write, read and disconnect. (Read is based on a polling system)

https://github.com/Neoministein/R2Northstar-Websocket

Neoministein avatar May 30 '23 21:05 Neoministein

Plugin linked above has been updated to latest Northstar Plugins version (v4) and probably covers this use-case quite well unless there's still need to have it dedicated in Northstar.

GeckoEidechse avatar Aug 12 '24 14:08 GeckoEidechse