nuclearace / Socket.IO-Client-Swift

socket.io-client for Swift
Other
361 stars 53 forks source link

Socket neither emitting nor retrieving. #145

Open alvin-george opened 7 years ago

alvin-george commented 7 years ago

This is my configuration.

var socket = SocketIOClient(socketURL: URL(string: "http://eyalzayed.com")!,config: [.log(true), .connectParams(["civilId" : "CIV1T111"]),.reconnects(true),.reconnectAttempts(2),.reconnectWait(2000),.forcePolling(true)])

On ViewDidLoad, I am connecting it.. It works..

override func viewDidLoad() {
    super.viewDidLoad()
    self.socket.connect()
}

But On Emitting Messages:

let parameters = ["from": "CIV1T111", "to": "CIV1F111", "fromName": "Alvin","toName": "Test parent", "message": "my test message", "timeStamp": "(timeStampString)"] self.socket.emit("new message", with: parameters)

Its not sending message on server.

The same way, the retrieving of messages also not working..

socket.on("new message") { (dataArray, socketAck) -> Void in
 print("dataArray : \(dataArray)")
}

Any solutions?