Quickstart
Relay is a fully managed pub / sub service. This is a quickstart to get you up and running with Relay SDKs in minutes.
Prerequisites
You need to complete the setup first (< 3 mins to complete):
Goal
Send messages between 2 clients via the public internet, in real-time, using Relay's Pub / Sub SDK
Select Your Platform
Choose SDK:
SDK Installation
Please select a platform above to see installation instructions.
SDK Initialization
Initialize the SDKs with the API Key & Secret key so it can connect to the Relay Network.
// Select a platform to see code
Subscribe
info
Topics are subscribed to using on($topic, $callback_func)
- Initialize listeners for the topic
chat.room1and theCONNECTEDtopic. - The
CONNECTEDtopic is a reserved SDK Topic which calls its listener (if initialized) when the SDK connects to the Relay Network.
// Select a platform to see code
Publish
info
Messages are published to topics using publish($topic, $message)
// Select a platform to see code
Connect
info
We connect to the Relay Network using connect()
// Select a platform to see code
info
Like what you see? Sign up and try it out now!