Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Scaledrone Go Client

scaledrone-go is a Go client package for accessing the Scaledrone REST API. gopher

Example

package main

import (
	"fmt"

	"github.com/ScaleDrone/scaledrone-go"
)

func main() {
	// New Scaledrone Client
	channelID := "channel-id"
	secretKey := "secret-key"
	client := scaledrone.NewBasicAuthClient(channelID, secretKey)

	// Publishing to a single room
	_ = client.Publish([]byte("Hello Go"), "golang")

	// Publishing to a multiple rooms
	_ = client.PublishToRooms([]byte("Hello Go"), []string{"golang", "gopher"})

	// Getting the number of users connected to the channel
	count, _ := client.UsersCount()
	fmt.Println(count)

	// Getting the array of users connected to rooms
	users, _ := client.UsersInRooms()
	fmt.Println(users)

	// Getting the array of rooms that are not empty
	rooms, _ := client.ActiveRooms()
	fmt.Println(rooms)

	// Getting the array of users in a room
	users, _ = client.UsersInRoom("empty-room")
	fmt.Println(users)

	// Getting the map of rooms to members
	roomsMap, _ := client.RoomMembers()
	fmt.Println(roomsMap)
}

About

Golang client for Scaledrone Realtime Messaging Service

Topics

Resources

Releases

No releases published

Packages

No packages published

Languages