pusher / docs

The all new Pusher docs, powered by @11ty and @vercel
https://pusher.com/docs
8 stars 15 forks source link

Pusher Channels Docs | JavaScript Quick Start Guidepage #298

Closed kleenkanteen closed 1 year ago

kleenkanteen commented 1 year ago

Hello there, I spotted an issue on https://pusher.com/docs/channels/getting_started/javascript/

It would be nice if it explained the difference between the Client SDK and the Server SDK. Especially why the client SDK can't be used on both the frontend and the server. I have a nextjs project I want to use pusher on.

Also, in https://pusher.com/docs/channels/using_channels/events/, it talks about client events. Can I trigger a non-client from the client SDK, provided I initialize the client SDK with all necessary secerets?

benw-pusher commented 1 year ago

A brief overview of the difference between a 'server' library and a 'client' library can be found at https://pusher.com/docs/channels/channels_libraries/libraries/. Pusher Channels is a pub/sub service and our server libraries are the 'pub', while the client libraries are the 'sub': servers publish the events and the clients subscribe to channels and consume the events.

It is not possible to trigger non-client events from the client SDK. A common approach to working around this is to user HTTP requests to your backend which then publishes the necessary event.

kleenkanteen commented 1 year ago

Thanks, that clears it.