Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mischa-hildebrand/37c8b9511bcffa089f1c9ee0467bf9c9 to your computer and use it in GitHub Desktop.
Save mischa-hildebrand/37c8b9511bcffa089f1c9ee0467bf9c9 to your computer and use it in GitHub Desktop.
Web Socket Delegate
extension MessageDataStore: WebSocketDelegate {
func websocketDidReceiveData(socket: WebSocketClient, data: Data) {
if let message = try? JSONDecoder().decode(Message.self, from: data) {
add(message, direction: .received)
}
}
// ...
// Other delegate method implementations
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment