To run the example project, clone the repo, and run pod install
from the Example directory first.
WebSocketServer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'WebSocketServer', :git => 'https://github.com/KhazanGu/WebSocketServer.git'
WebSocketServer is available under the MIT license. See the LICENSE file for more info.
The WebSocketServer class is an object for management to communicate with clients.
Create a server object for management.
let server = WebSocketServer()
Run the WebSocket Server on the specified port.
server.start(with: self, port: port)
Stop the WebSocket Server.
server.stop()
Send text to client.
server.send(text: text)
Get the IP address after the server start.
func started(on IPAddress: String) -> Void
Receive the text from the client.
func didReceive(text: String) -> Void