3 // WSRequest means the data structure of the request
4 type WSRequest struct {
5 Topic string `json:"topic"`
8 // NewWSRequest creates a request data object
9 func NewWSRequest(topic string) *WSRequest {
15 // WSResponse means the returned data structure
16 type WSResponse struct {
17 NotificationType string `json:"notification_type"`
18 Data interface{} `json:"data"`
19 ErrorDetail string `json:"error_detail,omitempty"`
22 // NewWSResponse creates a return data object
23 func NewWSResponse(notificationType string, data interface{}, err error) *WSResponse {
24 wsResp := &WSResponse{
25 NotificationType: notificationType,
30 wsResp.ErrorDetail = err.Error()