What are the equivalent of TCP Client and TCP Server for Swift - ios

Hi I am a newbie in iOS and Swift. I did some search on internet and i could not find a definite answer to my quest. I found socket.io but this is web socket.
Can you help and tell me the equivalent of TCP Client and TCP server for iOS for Swift 3.
I have these questions
If I use the iOS-base equivalent TCP client to send a message to server
1) On server-side, can I use other TCP Server to return message? any issue?
Thanks

I highly recommend to use Http request to send request to server and get a response from server, for more info check this question.And also to send data to client from server directly send a push notification to client.
However look at this link for tcp communication.

Related

SOCKS5 UDP Associate after SOCKS5 Connect to TCP at HTTP Web-Server?

question in title.
I have tried to send a TCP packet to an http endpoint, which worked.
However since all requests after that are forwarded and not handled it seems,
how do I establish a UDP associate afterwards?
Thanks in regards, any help is appreciated.

Rails. using a web socket like rest, but with an open connection

I have a web api that posts json to different external endpoints on certain conditions. We have a new client that wants us to open a web socket connection with them during an event, send them the data (json) when we get it via this socket, and close the socket after the event. I'm having a hard time figuring out the rails way to do this.
How do I open a web socket connection and keep it open? (basically where would the client sit/ what would the definition look like).
How do I send messages over the socket from a controller? (eg. after processing a post request send new data to this websocket)
How do I close the connection?
You can try using this gem called Faye. Here's an example for connecting and sending data: (note: I didn't test it)
# Open the connection
ws = Faye::WebSocket::Client.new('ws://www.example.com/')
# Send data to connection
ws.send(YOURJSONDATA)
# Close connection (RFC 6455)
ws.close
Notes for faye:
Using the WebSocket client
Adding headers and other options to connection
WebSocket API
RFC 6455
Hope it helps!

Creating a websocket with ngrok

I am using ngrok to tunnel to my ASP.NET core application. I am using Fleck to try and create a websocket connection between my application (server side) and an external API (client side). The problem is, the API requires a URL (ws://mysite.com/socket) that it will request a websocket connection from, however, the WebSocketServer(ip) object creates a websocket on a certain IP address and port. Can I tell the API to try and establish a connection with ws://5f1ce6fe.ngrok.io? Also, how do I find the IP address/port combination using ngrok that I will use to open the appropriate websocket on my server so that it accepts a websocket request at ws://5f1ce6fe.ngrok.io?
Thanks

Unable to connect WebSocket API hosted on Socket.IO

I am trying to connect to WebSocket API : http://kaboom.rksv.net/ using Socket.IO framework for iOS, i am banging my head to understand how to open the connection with this.
I have tried many possibilities and it did not work. Any help would be greatly appreciated.
If the server talks the WebSocket protocol, you have to use a WebSocket client library. On the other hand, if the server talks the Socket.IO protocol, you have to use a Socket.IO client library. Below is an excerpt from Socket.IO page in Wikipedia.
Socket.IO is not a WebSocket library with fallback options to other realtime protocols. It is a custom realtime transport protocol implementation on top of other realtime protocols. Its protocol negotiation parts cause a client supporting standard WebSocket to not being able to contact a Socket.IO server. And a Socket.IO implementing client cannot talk to a non-Socket.IO based WebSocket or Long Polling Comet server. Therefore Socket.IO requires using the Socket.IO libraries on both client and server side.

Does iOS send HTTPS requests through the HTTP proxy?

I am trying to write up an HTTP proxy server in node.js, and I have successfully managed to route unsecure HTTP connections through it. But when applications (on my iOS device) use HTTPS for APIs 'n such, it always throws an error, and the attempted HTTPS connection never hits the server. So there are a few explanations of what could possibly be happening:
iOS chooses not to send HTTPS connections over the proxy for security reasons
iOS is looking for an HTTPS connection at the server on a different port, but can't find one
Basically what I am asking is: What does iOS do with HTTPS connections when an HTTP proxy is configured?
Please ask for any details or further questions in the comments. Thanks.

Resources