PieSocket Realtime SDK for WebSockets written in Swift. Supports cross-platform Xcode projects for: iOS, iPad, Mac, etc.
Simply import this github repository into your Xcode project.
- In your Xcode project, go to File > Add packages
- Enter
https://github.com/piesocket/piesocket-swiftin the search box - Click "Add package"
Use following code to create a Channel with Managed PieSocket Server.
Get your API key and Cluster ID here: Get API Key
let options: PieSocketOptions = PieSocketOptions();
options.setClusterId(clusterId: "demo");
options.setApiKey(apiKey: "VCXCEuvhGcBDP7XhiJJUDvR1e1D3eiVjgZ9VRiaV");
let piesocket: PieSocket = PieSocket(pieSocketOptions: options);
let channel: Channel = piesocket.join(roomId: "chat-room");Use the following code to create a Channel with a self-hosted PieSocket Server.
let options: PieSocketOptions = PieSocketOptions();
options.setClusterDomain(clusterDomain: "localhost:4001");
options.setSsl(ssl: false);
let piesocket: PieSocket = PieSocket(pieSocketOptions: options);
let channel: Channel = piesocket.join(roomId: "chat-room");PieSocket Realtime is scalable WebSocket API service with following features:
- Authentication
- Private Channels
- Presence Channels
- Publish messages with REST API
- Auto-scalability
- Webhooks
- Analytics
- Authentication
- Upto 60% cost savings
system:connected is the event fired when WebSocket connection is ready, get a full list system messages here: PieSocket System Messages
For usage examples and more information, refer to: Official SDK docs