Building42 / Telegraph

Secure Web Server for iOS, tvOS and macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sending WebSocket messages

DylanDuff opened this issue · comments

How would I go about sending a message to a connected ws client other than using the existing functions in ServerWebSocketDelegate? They work perfectly for establishing the connection but im unsure how to reference the WebSocket instance in order to send messages other than replying to received messages or the initial connection. I tried storing the socket in a constant upon connection so I could just call .send on the stored constant but that doesnt seem to work outside the delegate, and in my use case I need to send a message to the connected client every-time a file is updated in elsewhere in my app

A few days later and I realised I was initialising the variable I wanted to reference in the wrong place, sorry for opening an issue for a non-issue with the framework itself 😅 Really love the project, thanks for all the work you've put in!