socket.io-client-swift
socket.io-client-swift copied to clipboard
When i use emit "Ack: false"
Hello i have problem when i am using SocketIO in ios ack always false and the data are is empty but in web and android app working fine.Every thing was working fine on socket two now on socket three I facing this problem.
2021-02-10 16:08:22.950858+0500 Yiies[50060:842759] LOG SocketEngine: Got message: 3probe 2021-02-10 16:08:23.043635+0500 Yiies[50060:841186] LOG SocketIOClient{/}: Emitting: 2["load:user-location",{"UserId":"5efb65bc8e334325c8c1eddc","location":{"accuracy":-1,"lat":33.682400000000001,"lng":72.990899999999996,"bearer":0,"speed":-1,"update_at":1612954914.470084}}], Ack: false ine: Switching to WebSockets 2021-02-10 16:08:23.043637+0500 Yiies[50060:847055] LOG SocketEngine: Received probe response, should upgrade to WebSockets 2021-02-10 16:08:23.043755+0500 Yiies[50060:843043] LOG SocketEngine: Received probe response, should upgrade to WebSockets 2021-02-10 16:08:23.044188+0500 Yiies[50060:841186] LOG SocketIOClient{/}: Emitting: 2["update:user-location",{"UserId":"5efb65bc8e334325c8c1eddc","location":{"accuracy":-1,"lat":33.682400000000001,"lng":72.990899999999996,"bearer":0,"speed":-1,"update_at":1612954914.470084}}], Ack: false 2021-02-10 16:08:23.043811+0500 Yiies[50060:842759] LOG SocketEngine: Received probe response, should upgrade to WebSockets 2021-02-10 16:08:23.044376+0500 Yiies[50060:847056] LOG SocketEngineWebSocket: Sending ws: as type: 5 2021-02-10 16:08:23.045005+0500 Yiies[50060:847055] LOG SocketEngine: Upgrading transport to WebSockets 2021-02-10 16:08:23.045406+0500 Yiies[50060:847056] LOG SocketEngine: Flushing probe wait 2021-02-10 16:08:23.045634+0500 Yiies[50060:843043] LOG SocketEngine: Upgrading transport to WebSockets 2021-02-10 16:08:23.046587+0500 Yiies[50060:842759] LOG SocketEngine: Upgrading transport to WebSockets 2021-02-10 16:08:23.045900+0500 Yiies[50060:847055] LOG SocketEnginePolling: Sending poll: as type: 6 2021-02-10 16:08:23.047010+0500 Yiies[50060:847056] LOG SocketEngine: Writing ws: 2["load:user-location",{"UserId":"5efb65bc8e334325c8c1eddc","location":{"accuracy":-1,"lat":33.682400000000001,"lng":72.990899999999996,"bearer":0,"speed":-1,"update_at":1612954914.470084}}] has data: false 2021-02-10 16:08:23.072557+0500 Yiies[50060:842759] LOG SocketEnginePolling: Sending poll: as type: 6 2021-02-10 16:08:23.072700+0500 Yiies[50060:843043] LOG SocketEnginePolling: Sending poll: as type: 6 2021-02-10 16:08:23.072849+0500 Yiies[50060:847055] LOG SocketEnginePolling: Created POST string: 6 2021-02-10 16:08:23.073081+0500 Yiies[50060:847056] LOG SocketEngineWebSocket: Sending ws: 2["load:user-location",{"UserId":"5efb65bc8e334325c8c1eddc","location":{"accuracy":-1,"lat":33.682400000000001,"lng":72.990899999999996,"bearer":0,"speed":-1,"update_at":1612954914.470084}}] as type: 4 2021-02-10 16:08:23.073294+0500 Yiies[50060:842759] LOG SocketEnginePolling: Created POST string: 6 2021-02-10 16:08:23.073321+0500 Yiies[50060:843043] LOG SocketEnginePolling: Created POST string: 6 2021-02-10 16:08:23.073671+0500 Yiies[50060:847055] LOG SocketEnginePolling: POSTing 2021-02-10 16:08:23.077616+0500 Yiies[50060:841186] LOG SocketIOClient{/}: Handling event: pong with data: [] 2021-02-10 16:08:23.075603+0500 Yiies[50060:847056] LOG SocketEngine: Writing ws: 2["update:user-location",{"UserId":"5efb65bc8e334325c8c1eddc","location":{"accuracy":-1,"lat":33.682400000000001,"lng":72.990899999999996,"bearer":0,"speed":-1,"update_at":1612954914.470084}}] has data: false 2021-02-10 16:08:23.078802+0500 Yiies[50060:843043] LOG SocketEnginePolling: POSTing 2021-02-10 16:08:23.079473+0500 Yiies[50060:842759] LOG SocketEnginePolling: POSTing 2021-02-10 16:08:23.080697+0500 Yiies[50060:847055] LOG SocketEnginePolling: Got polling response
What client version are you using?
15.2.0
On Wed, Feb 10, 2021, 18:06 Erik Little [email protected] wrote:
What client version are you using?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/socketio/socket.io-client-swift/issues/1325#issuecomment-776693014, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJLO4AQXPGOGH2BMCLSIF3S6KAETANCNFSM4XMYCUIQ .
Update to 16 for socket.Io 3 support
I searched but I found v15.2.0 latest
Can you please give me link of v16. Thanks
https://cocoapods.org/pods/Socket.IO-Client-Swift for CocoaPods. You can also use Swift Package manager and specify the tag v16.0.0
Thanks alot. Let me try
Pod Updated but also get same error.
2021-02-10 19:11:16.388237+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 23["update:user-location",{"userId":"5efb65bc8e334325c8c1eddc","location":{"update_at":1612966214.322484,"accuracy":-1,"speed":-1,"bearer":0,"lng":72.990899999999996,"lat":33.682400000000001}}], Ack: false 2021-02-10 19:11:16.388586+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 2["init:user-register",{"tokenAuth":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZWZiNjViYzhlMzM0MzI1YzhjMWVkZGMiLCJlbWFpbCI6ImFtbmVzaWFyazFAZ21haWwuY29tIiwiZmlyc3RfbmFtZSI6IkRhc2hpZWxfR21haWwiLCJwYXNzd29yZCI6IiQyYSQxMCRqdEUwc3Zvd3RQdHBXODlLR2FLY2ZlRHpRdjhWMUNOYzdGQ0x5MnNSVEh2MExJRndVd2Y1dSIsInJvbGUiOiJST0xFX0FETUlOIiwiaWF0IjoxNjEyOTY0NjY1LCJleHAiOjE2MjE2MDQ2NjV9.-u8_Wu-mQEvLFfPHq89Qq1KZESE1U9cePwpxYuMYN1A","location":{"speed":-1,"bearer":0,"lng":72.990899999999996,"lat":33.682400000000001,"accuracy":-1,"update_at":1612966214.322484}}], Ack: false 2021-02-10 19:11:19.345298+0500 Yiies[10900:452990] LOG OnAckCallback: OnAckCallback for 2 being released 2021-02-10 19:11:19.678626+0500 Yiies[10900:452990] LOG OnAckCallback: OnAckCallback for 3 being released 2021-02-10 19:11:39.268796+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 2["load:user-location",{"location":{"bearer":0,"update_at":1612966214.322484,"speed":-1,"lng":72.990899999999996,"lat":33.682400000000001,"accuracy":-1},"userId":"5efb65bc8e334325c8c1eddc"}], Ack: false 2021-02-10 19:11:39.269186+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 22["update:user-location",{"location":{"bearer":0,"update_at":1612966214.322484,"speed":-1,"lng":72.990899999999996,"lat":33.682400000000001,"accuracy":-1},"userId":"5efb65bc8e334325c8c1eddc"}], Ack: false 2021-02-10 19:11:39.269544+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 2["init:user-register",{"tokenAuth":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZWZiNjViYzhlMzM0MzI1YzhjMWVkZGMiLCJlbWFpbCI6ImFtbmVzaWFyazFAZ21haWwuY29tIiwiZmlyc3RfbmFtZSI6IkRhc2hpZWxfR21haWwiLCJwYXNzd29yZCI6IiQyYSQxMCRqdEUwc3Zvd3RQdHBXODlLR2FLY2ZlRHpRdjhWMUNOYzdGQ0x5MnNSVEh2MExJRndVd2Y1dSIsInJvbGUiOiJST0xFX0FETUlOIiwiaWF0IjoxNjEyOTY0NjY1LCJleHAiOjE2MjE2MDQ2NjV9.-u8_Wu-mQEvLFfPHq89Qq1KZESE1U9cePwpxYuMYN1A","location":{"accuracy":-1,"lng":72.990899999999996,"speed":-1,"update_at":1612966214.322484,"lat":33.682400000000001,"bearer":0}}], Ack: false 2021-02-10 19:11:39.605471+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 2["load:user-location",{"location":{"speed":-1,"lat":33.682400000000001,"lng":72.990899999999996,"bearer":0,"accuracy":-1,"update_at":1612966214.322484},"userId":"5efb65bc8e334325c8c1eddc"}], Ack: false 2021-02-10 19:11:39.605774+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 23["update:user-location",{"userId":"5efb65bc8e334325c8c1eddc","location":{"lng":72.990899999999996,"speed":-1,"bearer":0,"accuracy":-1,"lat":33.682400000000001,"update_at":1612966214.322484}}], Ack: false 2021-02-10 19:11:39.606097+0500 Yiies[10900:452990] LOG SocketIOClient{/}: Emitting: 2["init:user-register",{"tokenAuth":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZWZiNjViYzhlMzM0MzI1YzhjMWVkZGMiLCJlbWFpbCI6ImFtbmVzaWFyazFAZ21haWwuY29tIiwiZmlyc3RfbmFtZSI6IkRhc2hpZWxfR21haWwiLCJwYXNzd29yZCI6IiQyYSQxMCRqdEUwc3Zvd3RQdHBXODlLR2FLY2ZlRHpRdjhWMUNOYzdGQ0x5MnNSVEh2MExJRndVd2Y1dSIsInJvbGUiOiJST0xFX0FETUlOIiwiaWF0IjoxNjEyOTY0NjY1LCJleHAiOjE2MjE2MDQ2NjV9.-u8_Wu-mQEvLFfPHq89Qq1KZESE1U9cePwpxYuMYN1A","location":{"speed":-1,"bearer":0,"update_at":1612966214.322484,"accuracy":-1,"lng":72.990899999999996,"lat":33.682400000000001}}], Ack: false 2021-02-10 19:11:42.561054+0500 Yiies[10900:452990] LOG OnAckCallback: OnAckCallback for 2 being released 2021-02-10 19:11:42.897546+0500 Yiies[10900:452990] LOG OnAckCallback: OnAckCallback for 3 being released
While trying from Swift package manager geting this warning.
![Screenshot 2021-02-10 at 7 13 17 PM](https://user-images.githubusercontent.com/76724080/107521167-0a997500-6bd4-11eb-9ef2-550d828a5d45.png)
Hm, I'll take a look later today
okay. I will wait for your response.
Later today turned into right now
What does your client/server code look like?
When I do
socket.emitWithAck("noItemsAckEmit").timingOut(after: 3) {data in
print("got ack for no items ack emit", data)
}
I get an ack back when server has:
socket.on('noItemsAckEmit', (ack) => {
console.log('got no items ack emit')
ack(2)
})
I have tried this but getting ack as ["No ACK"].
What does your server code look like? The server should be explicitly calling with a return ack.
I did't have server access.
On Wed, Feb 10, 2021, 19:59 Erik Little [email protected] wrote:
What does your server code look like? The server should be explicitly calling with a return ack.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/socketio/socket.io-client-swift/issues/1325#issuecomment-776765808, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJLO4C7LHAVXKZ43CZUVILS6KNN3ANCNFSM4XMYCUIQ .
I'd need to see the server code I think. My test setup shows acking working properly if the server/client requests an ack.
Okay let me ask backend team and get back to you when I get the code.
On Wed, Feb 10, 2021, 20:22 Erik Little [email protected] wrote:
I'd need to see the server code I think. My test setup shows acking working properly if the server/client requests an ack.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/socketio/socket.io-client-swift/issues/1325#issuecomment-776783841, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJLO4FL2Q7NISLSF3ZEJRDS6KQDJANCNFSM4XMYCUIQ .
fyi, if the server needs to receive acks from the client, it should look something like this:
socket.emit("ackEvent", "gakgakgak", (re, name) => {
console.log("Got ack for ackEvent")
})
Okay I asked the backend team . Thanks
On Wed, Feb 10, 2021, 20:26 Erik Little [email protected] wrote:
fyi, if the server needs to receive acks from the client, it should look something like this:
socket.emit("ackEvent", "gakgakgak", (re, name) => { console.log("Got ack for ackEvent")})
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/socketio/socket.io-client-swift/issues/1325#issuecomment-776790027, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJLO4AXVS3DHZ3MLHJ7GY3S6KQR7ANCNFSM4XMYCUIQ .
Now I am getting an other error with the above issue.
Logs?
Now I have add dependency with master branch . Now error is not coming but some time socket stop responding.
Now is looking like this.
2021-02-12 20:25:38.591990+0500 Yiies[50774:894600] LOG SocketEnginePolling: Got polling response 2021-02-12 20:25:38.592176+0500 Yiies[50774:894600] LOG SocketEnginePolling: Got poll message: 2 2021-02-12 20:25:38.592342+0500 Yiies[50774:894600] LOG SocketEngine: Got message: 2 2021-02-12 20:25:38.592680+0500 Yiies[50774:894600] LOG SocketEnginePolling: Doing polling GET https://www.yiies.com/socket.io/?transport=polling&b64=1&EIO=4&sid=lCNpMHwQfeVuxUGMABrn 2021-02-12 20:25:38.592683+0500 Yiies[50774:894696] LOG SocketEnginePolling: Got polling response 2021-02-12 20:25:38.593278+0500 Yiies[50774:894696] LOG SocketEnginePolling: Got poll message: 2 2021-02-12 20:25:38.593892+0500 Yiies[50774:894696] LOG SocketEngine: Got message: 2 2021-02-12 20:25:38.594577+0500 Yiies[50774:894600] LOG SocketEngine: Writing poll: has data: false 2021-02-12 20:25:38.595182+0500 Yiies[50774:894696] LOG SocketEnginePolling: Doing polling GET https://www.yiies.com/socket.io/?transport=polling&b64=1&EIO=4&sid=zmBtI0YF69UnBGQ5ABro 2021-02-12 20:25:38.595438+0500 Yiies[50774:894600] LOG SocketEnginePolling: Sending poll: as type: 3 2021-02-12 20:25:38.596634+0500 Yiies[50774:894600] LOG SocketEnginePolling: Created POST string: 3 2021-02-12 20:25:38.597319+0500 Yiies[50774:894600] LOG SocketEnginePolling: POSTing 2021-02-12 20:25:38.597530+0500 Yiies[50774:894696] LOG SocketEngine: Writing poll: has data: false 2021-02-12 20:25:38.597805+0500 Yiies[50774:894600] LOG SocketEnginePolling: Doing polling POST https://www.yiies.com/socket.io/?transport=polling&b64=1&EIO=4&sid=lCNpMHwQfeVuxUGMABrn 2021-02-12 20:25:38.597958+0500 Yiies[50774:894696] LOG SocketEnginePolling: Sending poll: as type: 3 2021-02-12 20:25:38.598488+0500 Yiies[50774:894696] LOG SocketEnginePolling: Created POST string: 3 2021-02-12 20:25:38.599010+0500 Yiies[50774:894696] LOG SocketEnginePolling: POSTing 2021-02-12 20:25:38.599728+0500 Yiies[50774:894696] LOG SocketEnginePolling: Doing polling POST https://www.yiies.com/socket.io/?transport=polling&b64=1&EIO=4&sid=zmBtI0YF69UnBGQ5ABro
Hm, if master branch is working, then I don't think you actually got v16 installed correctly.
That log just shows polling happening, so something wrong with your business logic most likely.
Okay Thank you for the clarification
On Fri, Feb 12, 2021, 21:41 Erik Little [email protected] wrote:
Hm, if master branch is working, then I don't think you actually got v16 installed correctly.
That log just shows polling happening, so something wrong with your business logic most likely.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/socketio/socket.io-client-swift/issues/1325#issuecomment-778304592, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJLO4H7MXH5ATQFNBCOAOLS6VK3TANCNFSM4XMYCUIQ .
i also getting same issue in socket. ACK getting false when emit. SDK 16.0.2 and Node js socket 4.0 using.
Why this is happening?
If anyone experiencing a similar issue. Verify this
Init: socketURL: URL(string:"http://ip:port/some")
Access: self.socket = manager.socket(forNamespace: "/some")
Hi, someone find any solution? iOS client use spm SocketIO 16.0.1, but server working with version two.
i also getting same issue in socket. ACK getting false when emit. SDK 16.0.2 and Node js socket 4.0 using.
Why this is happening?
Did you get any solutions to this using socket io version 4.something?