AI integration

Your next feature
starts with a prompt.

Give your coding assistant the Persocket integration guide. It gets the endpoints, code patterns and authentication details it needs to work in your stack.

A head start for your coding assistantMarkdown guide
Read the guide

Make the first line your own: notifications, chat, a live dashboard. If your tool can’t open links, attach the guide’s Markdown instead.

Create an application in your workspace, copy the prompt into your coding tool, and add your credentials to your project’s environment when you’re ready to connect.

Prefer to wire it up yourself? Start here
The developer quickstart

From a few lines
to a shared moment.

Persocket connects your server events to your clients over WebSockets. Here’s everything you need to send your first one.

Start here

Continue with Google, create an application, and open its overview. Your app ID, public key and server secret are ready there.

Meet your credentials.

Each application is isolated with its own keys. Use the public key to connect clients and the secret to publish events from your server.

CredentialWhere it belongsWhat it does
Application IDServerIdentifies your app in API URLs
Public app keyBrowser or mobile clientOpens the WebSocket connection
App secretServer onlyAuthorizes publishing and private subscriptions

Open a connection. Find your channel.

Replace YOUR_APP_KEY with your public key. These examples listen on notifications. Open the HTTP tab to send an event to the same channel.

client.js
const socket = new WebSocket(  "wss://ws.persova.co/socket?appKey=YOUR_APP_KEY");socket.onopen = () => {  socket.send(JSON.stringify({    action: "subscribe", channel: "notifications"  }));};socket.onmessage = ({ data }) => {  const packet = JSON.parse(data);  if (packet.channel !== "notifications" || packet.event) return;  const event = JSON.parse(packet.data);  console.log(event.name, event.data);};

Subscribe in the browser, then publish an event from your server using the HTTP example.

Subscription acknowledgements are control messages. The example filters those out and reads the event’s name and data from the message envelope.

Give your clients something to talk about.

From your server, send a JSON payload to POST /api/apps/:id/events. Include your app secret as a Bearer token. All connected subscribers on that channel receive the event.

server.js
const response = await fetch(  "https://ws-api.persova.co/api/apps/YOUR_APP_ID/events",  {    method: "POST",    headers: {      "Content-Type": "application/json",      Authorization: `Bearer ${process.env.PERSOCKET_APP_SECRET}`    },    body: JSON.stringify({      channel: "notifications",      name: "order.created",      data: { orderId: "1042", message: "On its way!" }    })  });if (!response.ok) throw new Error("Event publish failed");

Send to several channels with a channel array. Treat a 207 response as a partial delivery and inspect its failed list. Events are delivered to clients that are currently connected; this is not a persistent message queue.

A channel for every kind of moment.

notifications

Public

Any client with your app key can subscribe. A good fit for public activity and shared updates.

private-user-42

Private

Your server approves each subscription. Use this for account notifications and access-controlled data.

presence-team

Presence

Authenticated subscriptions with a user identity, for knowing who is in the room.

Authorize on your server.

Your WebSocket connection’s first control message includes a socket_id inside its JSON data. Send that ID and the requested channel to your own authenticated backend. After checking that the current user may access the channel, call:

server-side authorization request
POST https://ws-api.persova.co/api/apps/YOUR_APP_ID/authAuthorization: Bearer YOUR_APP_SECRETContent-Type: application/json{  "socket_id": "CLIENT_SOCKET_ID",  "channel_name": "private-user-42"}

Return the resulting auth value to your client, then subscribe with { action: "subscribe", channel: "private-user-42", auth }. For presence channels, include user_id and optional user_info in the authorization request, and pass the returned channel_data along with auth when subscribing.

The app secret stays on your server. Your backend must verify who can access a private channel before requesting a signature.

Make it your own.

The quickstart keeps connection handling small so you can see the protocol clearly. Before shipping, add reconnect logic with backoff, resubscribe after reconnecting, and handle network errors in your interface. Sync durable application state from your own API when a client comes back online.

Use the application’s live console to test public, private and presence channels. It connects to your actual app and can publish sample JSON events. Historical analytics is shown separately when enabled.

Open your workspace