GithubHelp home page GithubHelp logo

socket.io-client-swift-example's Introduction

socket.io-client-swift-example's People

Contributors

e-sung avatar nuclearace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

socket.io-client-swift-example's Issues

requeriments for run this example

What I need for run this example? I have Xcode 6.2(6C131e), I download the project, I opened it with Xcode and I'm having 83 errors

Build for distribution

Hello,

I would like to use SocketIO as an dynamic dependency of my xcframework

I have checked your project and see that you don't use option BUILD_LIBRARY_FOR_DISTRIBUTION:
Screenshot 2022-09-13 at 17 51 50

why?

This option

Ensures that your libraries are built for distribution. For Swift, this enables support for library evolution and generation of a module interface file

https://xcodebuildsettings.com

Without forcing this option in Pods project there's the following error:

dyld[20229]: Symbol not found: _$s8SocketIO0A11ClientEventO5erroryA2CmFWC
  Referenced from: .../Frameworks/MyFramework.framework/MyFramework
  Expected in: .../MyApp.app/Frameworks/SocketIO.framework/SocketIO

Where is the disconnect method called?

I went through the sample and I can't see the disconnect method for disconnecting the socket.

I have called the socket.disconnect in deinit method of my iOS app. Is this the right way of doing it?

Thanks a lot for this library.

Won't build on recent Xcode 10.2 (and Swift 4.2) versions

  • after cloning and "pod install", the TicTac workspace won't build. There is great disagreement between all involved targets ( TicTac and its pod-dependencies socketIO, starScream, etc) about Swift version. Some specify Swift 3.1 (starScream) some have it unspecified - and so inherit the "Swift 3.0" set for TicTac, and all-in-all a big mess.

I don't know too well the source codes of all dependencies - and I'm afraid to hard-set their Swift versions to 4.2 --- how should I go about this?

No connection with simulator and localhost

I tried to run the sample using simulator and localhost server but app unable to connect, see the screenshot below:

Screenshot 2021-10-20 at 14 05 06

I am not sure is it a problem of iOS simulator restrictions or maybe Info.plist can be tweaked somehow to allow connections to localhost (something with ATS - apple transport security)?

I wanted to check that your sample works OK and then start modifying it as a base template to my needs but I can't pass the first milestone and verify that socket.io works with iOS. I am pretty sure it does but I couldn't verify it for myself with your sample.

What I tried so far:

  1. I tried to follow this answer for react native app connection issue with socket.io but with no luck I then receive another type of error mentioned here
  2. I tried with real device in combination with (1) but still same issue
  3. I tried to set forced update as here proposed in READ.me pod 'Socket.IO-Client-Swift', '~> 15.2.0'

P.S. I want to assure you that I followed your FAQ and didn't modify code of your sample (only for trying (1) and changing server address), so manager instance is global

server client crash

when i click, first time, at iOS client, the server client is crash
detail on the image
截屏2021-02-18 上午10 20 57
in index.js file line 76

Real device can't connect to server

I download the demo app, run well in simulator. But get error when using iPad, I use
socket.onAny {
print("Got event: ($0.event), with items: ($0.items!)")
}

to print log:

Got event: error, with items: ["Could not connect to the server."]

is anyone met this issue?

How its work?

I need all the emitted Keys and how to listen all the events for iOS or which backend tech is used?

The iOS app does not connect to the server

Building on iOS 14.1 and Xcode 12.2.

The server runs as expected. But the iOS app has trouble connecting to the server. Fails with an error: ["Error"].

I have verified the server by connecting a js client. Which was able to send and receive data.

Logs:

2020-11-30 02:26:11.033013+0530 TicTacIOiOS[23659:579640] ERROR SocketEngine: Error
2020-11-30 02:26:11.033410+0530 TicTacIOiOS[23659:579546] ERROR SocketManager: Error
2020-11-30 02:26:11.033451+0530 TicTacIOiOS[23659:579640] LOG SocketEngine: Engine is being closed.
2020-11-30 02:26:11.033890+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: error with data: ["Error"]
Got event: error, with items: ["Error"]
2020-11-30 02:26:11.035820+0530 TicTacIOiOS[23659:579640] LOG SocketEnginePolling: Created POST string: 1:1
2020-11-30 02:26:11.038152+0530 TicTacIOiOS[23659:579640] LOG SocketEnginePolling: Doing polling POST http://localhost:8900/socket.io/?transport=polling&b64=1&sid=cVuuxVgF13AZlC72AABx
2020-11-30 02:26:11.040059+0530 TicTacIOiOS[23659:579546] LOG SocketManager: Starting reconnect
2020-11-30 02:26:11.040529+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: statusChange with data: [connecting, 2]
Got event: statusChange, with items: [connecting, 2]
2020-11-30 02:26:11.041098+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: reconnect with data: ["Error"]
Got event: reconnect, with items: ["Error"]
2020-11-30 02:26:11.041764+0530 TicTacIOiOS[23659:579546] LOG SocketManager: Trying to reconnect
2020-11-30 02:26:11.042350+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: reconnectAttempt with data: [-1]
Got event: reconnectAttempt, with items: [-1]
2020-11-30 02:26:11.042833+0530 TicTacIOiOS[23659:579546] LOG SocketManager: Scheduling reconnect in 16.22947678523183s
2020-11-30 02:26:11.042896+0530 TicTacIOiOS[23659:579640] LOG SocketEngine: Starting engine. Server: http://localhost:8900
2020-11-30 02:26:11.043875+0530 TicTacIOiOS[23659:579640] LOG SocketEngine: Handshaking
2020-11-30 02:26:11.044719+0530 TicTacIOiOS[23659:579640] LOG SocketEnginePolling: Doing polling GET http://localhost:8900/socket.io/?transport=polling&b64=1
2020-11-30 02:26:11.074289+0530 TicTacIOiOS[23659:579682] LOG SocketEnginePolling: Got polling response
2020-11-30 02:26:11.074494+0530 TicTacIOiOS[23659:579682] LOG SocketEnginePolling: Got poll message: 0{"sid":"BamXcopA70j7dQNAAABy","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}
2020-11-30 02:26:11.074696+0530 TicTacIOiOS[23659:579682] LOG SocketEngine: Got message: 0{"sid":"BamXcopA70j7dQNAAABy","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}
2020-11-30 02:26:11.077580+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: ping with data: []
2020-11-30 02:26:11.077657+0530 TicTacIOiOS[23659:579682] LOG SocketEnginePolling: Doing polling GET http://localhost:8900/socket.io/?transport=polling&b64=1&sid=BamXcopA70j7dQNAAABy
Got event: ping, with items: []
2020-11-30 02:26:11.078145+0530 TicTacIOiOS[23659:579546] LOG SocketManager: Engine opened Connect
2020-11-30 02:26:11.078371+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Socket connected
2020-11-30 02:26:11.078734+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: statusChange with data: [connected, 3]
Got event: statusChange, with items: [connected, 3]
2020-11-30 02:26:11.079113+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: connect with data: ["/"]
Got event: connect, with items: ["/"]
2020-11-30 02:26:11.080950+0530 TicTacIOiOS[23659:579682] LOG SocketEngine: Writing poll:  has data: false
2020-11-30 02:26:11.081774+0530 TicTacIOiOS[23659:579682] LOG SocketEnginePolling: Sending poll:  as type: 2
2020-11-30 02:26:11.082202+0530 TicTacIOiOS[23659:579682] LOG SocketEnginePolling: Created POST string: 1:2
2020-11-30 02:26:11.082650+0530 TicTacIOiOS[23659:579682] LOG SocketEnginePolling: POSTing
2020-11-30 02:26:11.083371+0530 TicTacIOiOS[23659:579682] LOG SocketEnginePolling: Doing polling POST http://localhost:8900/socket.io/?transport=polling&b64=1&sid=BamXcopA70j7dQNAAABy
2020-11-30 02:26:11.103587+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: websocketUpgrade with data: [["connection": "Upgrade", "sec-websocket-accept": "XnZbiSNCaCpMqSvXi3gbGPX4+Go=", "upgrade": "websocket"]]
Got event: websocketUpgrade, with items: [["connection": "Upgrade", "sec-websocket-accept": "XnZbiSNCaCpMqSvXi3gbGPX4+Go=", "upgrade": "websocket"]]
2020-11-30 02:26:11.104030+0530 TicTacIOiOS[23659:579634] LOG SocketEngineWebSocket: Sending ws: probe as type: 2
2020-11-30 02:26:11.106585+0530 TicTacIOiOS[23659:579635] LOG SocketEngine: Got message: 3probe
2020-11-30 02:26:11.109712+0530 TicTacIOiOS[23659:579635] LOG SocketEngine: Received probe response, should upgrade to WebSockets
2020-11-30 02:26:11.112925+0530 TicTacIOiOS[23659:579635] LOG SocketEngine: Upgrading transport to WebSockets
2020-11-30 02:26:11.118305+0530 TicTacIOiOS[23659:579635] LOG SocketEnginePolling: Sending poll:  as type: 6
2020-11-30 02:26:11.133363+0530 TicTacIOiOS[23659:579546] LOG SocketIOClient{/}: Handling event: pong with data: []
Got event: pong, with items: []
2020-11-30 02:26:11.134611+0530 TicTacIOiOS[23659:579635] LOG SocketEngine: Flushing probe wait
2020-11-30 02:26:11.138767+0530 TicTacIOiOS[23659:579635] LOG SocketEnginePolling: Got polling response
2020-11-30 02:26:11.139378+0530 TicTacIOiOS[23659:579635] LOG SocketEngine: Switching to WebSockets
2020-11-30 02:26:11.139910+0530 TicTacIOiOS[23659:579635] LOG SocketEngineWebSocket: Sending ws:  as type: 5
2020-11-30 02:26:11.141147+0530 TicTacIOiOS[23659:579635] LOG SocketEngine: Flushing probe wait

Steps to reproduce:

  1. Clone repo
  2. pod install
  3. cd server && npm install && node index.js
  4. Run iOS app using .xcworkspace file

Can't build client -- missing certain SocketIOClientSwift files

Hello,
I'm trying to get socket.io-client-swift-example running. I'm on step "Setup First Client." I've opened the project in Xcode but when I try to build and run I'm hit with a host of errors, all related to missing files:

<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketIOClient.swift'
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/WebSocket.swift'
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketEngineWebsocket.swift'
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketTypes.swift'
**<snip>**
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketEnginePacketType.swift'
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketStringReader.swift'
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketIOClientOption.swift'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

I browsed the socket.io-client-swift-example repo and noticed that the SocketIOClientSwift directory references a non-existent project (clicking it leads to a 404 error on github):

screen shot 2016-06-12 at 9 32 31 pm

So the next thing I did was go to the socket.io-client-swift repo and clone that to my socket.io-client-swift-example/TicTacIOiOS directory. Then I renamed it from socket.io-client-swift to SocketIOClientSwift since that is where Xcode was originally claiming it couldn't find the files.

Next I tried to build socket.io-client-swift-example again and indeed, most of the files are now found (the majority of error messages related to files not being found have disappeared). However, I am still getting errors about three missing files:

<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketClientSpec.swift'
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SocketFixUTF8.swift'
<unknown>:0: error: no such file or directory: '/Users/pzurek/dev/ios/sockets/socket.io-client-swift-example/TicTacIOiOS/SocketIOClientSwift/Source/SwiftRegex.swift'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

I've tried searching both repos for those files but I cannot find them. Any advice on how to proceed?

Thanks.

How to pass parameter on connect

In javascript, we can do it like this:
const socket = io('http://localhost?token=abc');
but it doesn't work on your framework.

How to get this up and running?

I love that you made an example of how to use Swift/Socket. I am new to both and still wrapping my head around how they work. I have a simple node server up and running, but not sure I understand how this all works.

I see you provided the node setup, but I don't really know what to do after 'node index.js'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.