diff socket/types.go @ 12:aaf85ae1f942

add very simple html template
author Dennis C. M. <dennis@denniscm.com>
date Thu, 20 Mar 2025 11:12:21 +0000
parents e9df3bb010f4
children
line wrap: on
line diff
--- a/socket/types.go	Sat Mar 15 17:08:03 2025 +0000
+++ b/socket/types.go	Thu Mar 20 11:12:21 2025 +0000
@@ -1,117 +1,118 @@
 package socket
 
-type Res_Metadata struct {
-	Metadata Metadata `json:"metadata"`
-}
-
-type Res_Metadata_Notif struct {
-	Metadata Metadata_Notif `json:"metadata"`
-}
-
-type Res_Welcome struct {
-	Metadata Metadata        `json:"metadata"`
-	Payload  Payload_Welcome `json:"payload"`
-}
-
-type Res_Keepalive struct {
-	Metadata Metadata          `json:"metadata"`
-	Payload  Payload_Keepalive `json:"payload"`
-}
-
-type Res_Notif_ChannelChatMsg struct {
-	Metadata Metadata_Notif               `json:"metadata,omitempty"`
-	Payload  Payload_Notif_ChannelChatMsg `json:"payload,omitempty"`
+type MetadataMsg struct {
+	Metadata struct {
+		MsgId        string `json:"message_id"`
+		MsgType      string `json:"message_type"`
+		MsgTimeStamp string `json:"message_timestamp"`
+	} `json:"metadata"`
 }
 
-type Metadata struct {
-	MsgId        string `json:"message_id"`
-	MsgType      string `json:"message_type"`
-	MsgTimestamp string `json:"message_timestamp"`
-}
+type WelcomeMsg struct {
+	Metadata struct {
+		MsgId        string `json:"message_id"`
+		MsgType      string `json:"message_type"`
+		MsgTimeStamp string `json:"message_timestamp"`
+	} `json:"metadata"`
 
-type Metadata_Notif struct {
-	Metadata
-	SubType    string `json:"subscription_type"`
-	SubVersion string `json:"subscription_version"`
+	Payload struct {
+		Session struct {
+			Id                   string `json:"id"`
+			Status               string `json:"status"`
+			ConnectedAt          string `json:"connected_at"`
+			KeepaliveTimeoutSecs int    `json:"keepalive_timeout_seconds"`
+			ReconnectUrl         string `json:"reconnect_url"`
+		} `json:"session"`
+	} `json:"payload"`
 }
 
-type Payload_Welcome struct {
-	Session struct {
-		Id               string `json:"id"`
-		Status           string `json:"status"`
-		ConnectedAt      string `json:"connected_at"`
-		KeepaliveTimeout int    `json:"keepalive_timeout_seconds"`
-	} `json:"session"`
+type KeealiveMsg struct {
+	Metadata struct {
+		MsgId        string `json:"message_id"`
+		MsgType      string `json:"message_type"`
+		MsgTimeStamp string `json:"message_timestamp"`
+	} `json:"metadata"`
+
+	Payload struct {
+	} `json:"payload"`
 }
 
-type Payload_Keepalive struct {
+type ReconnectMsg struct {
+	WelcomeMsg
 }
 
-type Payload_Notif_ChannelChatMsg struct {
-	Subscription Payload_Sub_Notif_ChannelChatMsg   `json:"subscription"`
-	Event        Payload_Event_Notif_ChannelChatMsg `json:"event"`
+type MetadataEvent struct {
+	Metadata struct {
+		MsgId        string `json:"message_id"`
+		MsgType      string `json:"message_type"`
+		MsgTimeStamp string `json:"message_timestamp"`
+		SubType      string `json:"subscription_type"`
+		SubVersion   string `json:"subscription_version"`
+	} `json:"metadata"`
 }
 
-type Payload_Sub_Notif struct {
-	Id      string `json:"id"`
-	Status  string `json:"status"`
-	Type    string `json:"type"`
-	Version string `json:"version"`
-	Cost    int    `json:"cost"`
+type ChannelChatMsgEvent struct {
+	Metadata MetadataEvent `json:"metadata"`
 
-	Transport struct {
-		Method    string `json:"method"`
-		SessionId string `json:"session_id"`
-	} `json:"transport"`
+	Payload struct {
+		Sub struct {
+			Id      string `json:"id"`
+			Status  string `json:"status"`
+			Type    string `json:"type"`
+			Version string `json:"version"`
+
+			Condition struct {
+				BroadcasterUserId string `json:"broadcaster_user_id"`
+				UserId            string `json:"user_id"`
+			} `json:"condition"`
 
-	CreatedAt string `json:"created_at"`
-}
+			Transport struct {
+				Method    string `json:"method"`
+				SessionId string `json:"session_id"`
+			} `json:"transport"`
 
-type Payload_Sub_Notif_ChannelChatMsg struct {
-	Payload_Sub_Notif
+			CreatedAt string `json:"created_at"`
+			Cost      int    `json:"cost"`
+		} `json:"subscription"`
 
-	Condition struct {
-		BroadcasterUserId string `json:"broadcaster_user_id"`
-		UserId            string `json:"user_id"`
-	} `json:"condition"`
-}
+		Event struct {
+			BroadcasterUserId    string `json:"broadcaster_user_id"`
+			BroadcasterUserLogin string `json:"broadcaster_user_login"`
+			BroadcasterUserName  string `json:"broadcaster_user_name"`
+			ChatterUserId        string `json:"chatter_user_id"`
+			ChatterUserLogin     string `json:"chatter_user_login"`
+			ChatterUserName      string `json:"chatter_user_name"`
+			MsgId                string `json:"message_id"`
 
-type Payload_Event_Notif_ChannelChatMsg struct {
-	BroadcasterUserId    string `json:"broadcaster_user_id"`
-	BroadcasterUserLogin string `json:"broadcaster_user_login"`
-	BroadcasterUserName  string `json:"broadcaster_user_name"`
-	ChatterUserId        string `json:"chatter_user_id"`
-	ChatterUserLogin     string `json:"chatter_user_login"`
-	ChatterUserName      string `json:"chatter_user_name"`
-	MsgId                string `json:"message_id"`
+			Msg struct {
+				Text string `json:"text"`
 
-	Msg struct {
-		Text string `json:"text"`
+				Fragments []struct {
+					Type      string `json:"type"`
+					Text      string `json:"text"`
+					Cheermote string `json:"cheermote"`
+					Emote     string `json:"emote"`
+					Mention   string `json:"mention"`
+				} `json:"fragments"`
+			} `json:"message"`
+
+			Color string `json:"color"`
 
-		Fragments []struct {
-			Type      string `json:"type"`
-			Text      string `json:"text"`
-			Cheermote string `json:"cheermote"`
-			Emote     string `json:"emote"`
-			Mention   string `json:"mention"`
-		} `json:"fragments"`
-	} `json:"message"`
-
-	Color string `json:"color"`
+			Badges []struct {
+				SetId string `json:"set_id"`
+				Id    string `json:"id"`
+				Info  string `json:"info"`
+			} `json:"badges"`
 
-	Badges []struct {
-		SetId string `json:"set_id"`
-		Id    string `json:"id"`
-		Info  string `json:"info"`
-	} `json:"badges"`
-
-	MsgType                     string `json:"message_type"`
-	Cheer                       string `json:"cheer"`
-	Reply                       string `json:"reply"`
-	ChannelPointsCustomRewardId string `json:"channel_points_custom_reward_id"`
-	SourceBroadcasterUserId     string `json:"source_broadcaster_user_id"`
-	SourceBroadcasterUserLogin  string `json:"source_broadcaster_user_login"`
-	SourceBroadcasterUserName   string `json:"source_broadcaster_user_name"`
-	SourceMessageId             string `json:"source_message_id"`
-	SourceBadges                string `json:"source_badges"`
+			MsgType                     string `json:"message_type"`
+			Cheer                       string `json:"cheer"`
+			Reply                       string `json:"reply"`
+			ChannelPointsCustomRewardId string `json:"channel_points_custom_reward_id"`
+			SourceBroadcasterUserId     string `json:"source_broadcaster_user_id"`
+			SourceBroadcasterUserLogin  string `json:"source_broadcaster_user_login"`
+			SourceBroadcasterUserName   string `json:"source_broadcaster_user_name"`
+			SourceMessageId             string `json:"source_message_id"`
+			SourceBadges                string `json:"source_badges"`
+		} `json:"event"`
+	} `json:"payload"`
 }