Initial commit

This commit is contained in:
Yaser
2026-08-13 20:20:47 +03:30
commit 78a0c832d7
33 changed files with 3399 additions and 0 deletions

26
pkg/message/msg.go Normal file
View File

@@ -0,0 +1,26 @@
package message
import (
"encoding/json"
)
type Request struct {
Method string
Streams []string
}
func PackOutgoingResponse(err error, message interface{}) ([]byte, error) {
res := make(map[string]interface{}, 1)
if err != nil {
res["error"] = err.Error()
} else {
res["success"] = message
}
return json.Marshal(res)
}
func PackOutgoingEvent(channel string, data interface{}) ([]byte, error) {
resp := make(map[string]interface{}, 1)
resp[channel] = data
return json.Marshal(resp)
}