R2Northstar / NorthstarLauncher

Launcher used to modify Titanfall 2 to allow mods to be loaded
MIT License
269 stars 125 forks source link

Potentially add Websocket support for Squirrel mods #372

Open Erlite opened 1 year ago

Erlite commented 1 year ago

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.

MommyHeather commented 1 year ago

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.

pg9182 commented 1 year ago

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.

Erlite commented 1 year ago

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

Neoministein commented 1 year ago

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?

Erlite commented 1 year ago

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.

zweek commented 1 year ago

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

GeckoEidechse commented 1 year ago

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 ;)

Neoministein commented 1 year ago

@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