https://github.com/scaledrone/scaledrone-go
Golang client for Scaledrone Realtime Messaging Service
https://github.com/scaledrone/scaledrone-go
go golang real-time scaledrone
Last synced: 3 months ago
JSON representation
Golang client for Scaledrone Realtime Messaging Service
- Host: GitHub
- URL: https://github.com/scaledrone/scaledrone-go
- Owner: ScaleDrone
- Created: 2017-03-15T17:31:45.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-15T18:18:12.000Z (about 8 years ago)
- Last Synced: 2025-01-25T11:43:59.507Z (4 months ago)
- Topics: go, golang, real-time, scaledrone
- Language: Go
- Homepage: https://www.scaledrone.com/
- Size: 19.5 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scaledrone Go Client
scaledrone-go is a Go client package for accessing the Scaledrone REST API.
# Example
```go
package mainimport (
"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)
}
```