kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

Events not working over websockets? [TestServer]

lucaelin opened this issue · 4 comments

commented

For some reason, my WebSocket client never receives a StreamUpdate with the StreamId that it got from a rpc-call that returned an Event.
I'm testing this against the TestServer using TestService.onTimer... The stream returned never gets a single update.
Note that this might very well be an issue with my implementation, so any feedback is greatly appreciated!

commented

Ah, i just figured that the client needs to explicitly call the addStream function found in the KRPC service for events to work... Is this documented somewhere?! 🤣

commented

Not sure. I've reopened this to remind me to check.

commented

This appears to be documented here: http://localhost:8080/communication-protocols/messages.html#streams
Let me know if anything in that documentation is unclear.

commented

Yeah, I think what I was missing is that the Stream inside an Event isn't started by default and the server is explicitly holding back on telling the client about the events, until the client tells the server to start the stream. This can lead to the client missing some updates that are firing right after creation of the Event, before the client tells the server to start the stream. On the other hand, this ensures that the client already knows how to handle the incoming streamupdates... hmm...