How to subscribe? see here
Use the following code snippets to publish a message/event on a WebSocket Channel Room with curl or wget.
# Demo Cluster ID, API key and secret used, get yours at https://piesocket.com
curl --location --request POST 'https://CLUSTER_ID.piesocket.com/api/publish' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm",
"secret": "d8129f82f8dd71910aa4a7efa30a7297",
"roomId": "room_1",
"message": {"event":"new-message","data":"Hello"}
}'
# Demo Cluster ID, API key and secret used, get yours at https://piesocket.com
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Content-Type: application/json' \
--body-data '{
"key": "oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm",
"secret": "d8129f82f8dd71910aa4a7efa30a7297",
"roomId": "room_1",
"message": {"event":"new-message","data":"Hello"}
}' \
'https://CLUSTER_ID.piesocket.com/api/publish'
This sends a JSON message to the Room: room_1
.
Please note that this example uses a demo key and secret, which is public. The demo key is only for quick testing purposes, and you should not use this in your application.
You can get your free API key and API secret here.
Facing difficulties? Use the chat box on the bottom-right corner of this page to reach us.