Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func publishMessage() {
- if(messageTextField.text != "" || messageTextField.text != nil){
- let messageString: String = messageTextField.text!
- let messageObject : [String:Any] =
- [
- "message" : messageString,
- "username" : username,
- "uuid": client.uuid()
- ]
- client.publish(messageObject, toChannel: channelName) { (status) in
- print(status.data.information)
- }
- messageTextField.text = ""
- }
- }
- //When the send button is clicked, the message will send
- @IBAction func sendMessage(_ sender: UIButton) {
- publishMessage()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement