PieSocket Realtime SDK for Android written in Java.
Let's start by adding PieSocket Android SDK as a dependency to your application.
implementation("com.piesocket:channels-sdk:2.1.0")
implementation 'com.piesocket:channels-sdk:2.1.0'
<dependency>
<groupId>com.piesocket</groupId>
<artifactId>channels-sdk</artifactId>
<version>2.1.0</version>
</dependency>
Setup manifest permissions as instructed here.
Use following code to create a Channel with PieSocket's managed WebSocket servers.
Get your API key and Cluster ID here: Get API Key
PieSocketOptions options = new PieSocketOptions();
options.setClusterId("demo");
options.setApiKey("VCXCEuvhGcBDP7XhiJJUDvR1e1D3eiVjgZ9VRiaV");
PieSocket piesocket = new PieSocket(options);
Channel channel = piesocket.join("chat-room-1");Use following code to create a Channel with PieSocket self-hosted realtime servers.
PieSocketOptions options = new PieSocketOptions();
options.setClusterDomain("localhost:4001");
options.setSsl(false);
PieSocket piesocket = new PieSocket(options);
Channel channel = piesocket.join("chat-room-1");PieSocket Channels is a 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