From d37253ed159b824fedff236685184bca168089f2 Mon Sep 17 00:00:00 2001 From: gezimblliku Date: Mon, 29 Jul 2024 15:29:56 +0200 Subject: [PATCH] updated handler message method & successMsg type --- janus.go | 4 +++- types.go | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/janus.go b/janus.go index 2679335..78b21bc 100644 --- a/janus.go +++ b/janus.go @@ -445,7 +445,7 @@ func (handle *Handle) Request(ctx context.Context, msg HandlerMessage) (*Success // body should be the plugin data to be passed to the plugin, and jsep should // contain an optional SDP offer/answer to establish a WebRTC PeerConnection. // On success, an AckMsg will be returned and error will be nil. -func (handle *Handle) Message(ctx context.Context, msg HandlerMessageJsep) (ack *AckMsg, err error) { +func (handle *Handle) Message(ctx context.Context, msg HandlerMessageJsep) (rpl any, err error) { ch := make(chan any) handle.send(msg, msg.ID, ch) @@ -454,6 +454,8 @@ func (handle *Handle) Message(ctx context.Context, msg HandlerMessageJsep) (ack switch msg := msg.(type) { case *AckMsg: return msg, nil + case *SuccessMsg: + return msg, nil case *ErrorMsg: return nil, msg } diff --git a/types.go b/types.go index caf8c33..a8f2583 100644 --- a/types.go +++ b/types.go @@ -67,9 +67,11 @@ func (err *ErrorMsg) Error() string { } type SuccessMsg struct { - Type string `json:"janus"` - ID string `json:"transaction"` - Data SuccessData `json:"data,omitempty"` + Type string `json:"janus"` + ID string `json:"transaction"` + Handle uint64 `json:"sender,omitempty"` + PluginData PluginData `json:"plugindata"` + Data SuccessData `json:"data,omitempty"` } type SuccessData struct {