Created
October 25, 2018 12:25
-
-
Save mischa-hildebrand/a5582982be0194502d32f550f2748a58 to your computer and use it in GitHub Desktop.
Send Messages
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
func send(_ message: Message) { | |
guard let data = try? JSONEncoder().encode(message) else { | |
// Handle error | |
return | |
} | |
webSocket?.write(data: data) | |
add(message, direction: .sent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment