Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion janus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}
Expand Down
8 changes: 5 additions & 3 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down