MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / SendNotification

Method SendNotification

pkg/lsp/server.go:453–467  ·  view source on GitHub ↗

SendNotification sends a notification to the client. This method sends a JSON-RPC 2.0 notification (a request without an ID) to the client. Notifications are one-way messages that do not expect a response. The server uses this method to push information to the client asynchronously, such as diagno

(method string, params interface{})

Source from the content-addressed store, hash-verified

451// If params is nil, an empty notification without params will be sent.
452// If marshaling params fails, the error is logged but no notification is sent.
453func (s *Server) SendNotification(method string, params interface{}) {
454 notif := Notification{
455 JSONRPC: "2.0",
456 Method: method,
457 }
458 if params != nil {
459 data, err := json.Marshal(params)
460 if err != nil {
461 s.logger.Printf("Failed to marshal notification params for %s: %v", method, err)
462 return
463 }
464 notif.Params = json.RawMessage(data)
465 }
466 s.sendMessage(notif)
467}
468
469// sendMessage sends a message to the client
470func (s *Server) sendMessage(msg interface{}) {

Callers 5

handleDidOpenMethod · 0.80
handleDidChangeMethod · 0.80
handleDidCloseMethod · 0.80
validateDocumentMethod · 0.80
sendParseErrorMethod · 0.80

Calls 1

sendMessageMethod · 0.95

Tested by

no test coverage detected