Created
October 25, 2018 09:54
-
-
Save mischa-hildebrand/37c8b9511bcffa089f1c9ee0467bf9c9 to your computer and use it in GitHub Desktop.
Web Socket Delegate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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