MCPcopy Create free account
hub / github.com/astercloud/aster / handleMessage

Method handleMessage

server/handlers/websocket.go:200–221  ·  view source on GitHub ↗

handleMessage handles different message types

(wsConn *WebSocketConnection, msg *WebSocketMessage)

Source from the content-addressed store, hash-verified

198
199// handleMessage handles different message types
200func (h *WebSocketHandler) handleMessage(wsConn *WebSocketConnection, msg *WebSocketMessage) {
201 switch msg.Type {
202 case "chat":
203 h.handleChat(wsConn, msg.Payload)
204 case "ping":
205 h.sendMessage(wsConn, "pong", nil)
206 case "todo_list_request":
207 h.handleTodoListRequest(wsConn, msg.Payload)
208 case "todo_create":
209 h.handleTodoCreate(wsConn, msg.Payload)
210 case "todo_update":
211 h.handleTodoUpdate(wsConn, msg.Payload)
212 case "todo_delete":
213 h.handleTodoDelete(wsConn, msg.Payload)
214 case "tool:control", "tool_control":
215 h.handleToolControl(wsConn, msg.Payload)
216 case "permission_decision":
217 h.handlePermissionDecision(wsConn, msg.Payload)
218 default:
219 h.sendError(wsConn, "unknown_message_type", "Unknown message type: "+msg.Type)
220 }
221}
222
223// handleChat handles chat messages
224func (h *WebSocketHandler) handleChat(wsConn *WebSocketConnection, payload map[string]any) {

Callers 1

readPumpMethod · 0.95

Calls 9

handleChatMethod · 0.95
sendMessageMethod · 0.95
handleTodoListRequestMethod · 0.95
handleTodoCreateMethod · 0.95
handleTodoUpdateMethod · 0.95
handleTodoDeleteMethod · 0.95
handleToolControlMethod · 0.95
sendErrorMethod · 0.95

Tested by

no test coverage detected