the official Golang API client for Stream chat a service for building chat applications.
You can sign up for a Stream account at https://getstream.io/chat/get_started/.
You can use this library to access chat API endpoints server-side, for the client-side integrations (web and mobile) have a look at the Javascript, iOS and Android SDK libraries (https://getstream.io/chat/).
go get github.com/GetStream/stream-chat-go/v3
- Chat channels
- Messages
- Chat channel types
- User management
- Moderation API
- Push configuration
- User devices
- User search
- Channel search
- Message search
HBase table and rowkey design
https://github.com/tsuna/gohbase
Access pattern
1)request chat entries from a specific chat room by time range
For chat application with multiple room options - Embedded Key Value store usage Badger is designed to support high throughput writes and reads with persistence in mind. One can also try badger with sync writes set to false in option, it would give better performance and also persist the data in async way.
package main
import (
"os"
stream "github.com/GetStream/stream-chat-go/v3"
)
var APIKey = os.Getenv("STREAM_CHAT_API_KEY")
var APISecret = os.Getenv("STREAM_CHAT_API_SECRET")
var userID = "" // your server user id
func main() {
client, err := stream.NewClient(APIKey, APISecret)
// handle error
// use client methods
// create channel with users
users := []string{"id1", "id2", "id3"}
channel, err := client.CreateChannel("messaging", "channel-id", userID, map[string]interface{}{
"members": users,
})
// use channel methods
msg, err := channel.SendMessage(&stream.Message{Text: "hello"}, userID)
}
Contributions to this project are very much welcome, please make sure that your code changes are tested and that follow Go best-practices.