From 44b912bafb7a05e4524adf87770b33e2008e2d81 Mon Sep 17 00:00:00 2001 From: Kevin McConnell Date: Tue, 9 Mar 2021 21:29:22 +0000 Subject: [PATCH] Small tweak to middleware docs (#460) --- pkg/middlewares/datachannel/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/middlewares/datachannel/README.md b/pkg/middlewares/datachannel/README.md index 9773fc56e..77ed70589 100644 --- a/pkg/middlewares/datachannel/README.md +++ b/pkg/middlewares/datachannel/README.md @@ -19,6 +19,7 @@ func SubscriberAPI(next sfu.MessageProcessor) sfu.MessageProcessor { ### Init middlewares To initialize the middlewares you need to declare them after sfu initialization: + ```go s := sfu.NewSFU(conf) dc := s.NewDatachannel(sfu.APIChannelLabel) @@ -27,4 +28,5 @@ dc.Use(datachannel.KeepAlive(5*time.Second), datachannel.SubscriberAPI) dc.OnMessage(func(ctx context.Context, msg webrtc.DataChannelMessage, in *webrtc.DataChannel, out []*webrtc.DataChannel) { }) ``` -The datachannels will be negotiated on peer join in the `Subscriber` peer connection. \ No newline at end of file + +Datachannels created in this way will be negotiated on peer join in the `Subscriber` peer connection. Clients can then get a reference to the channel by using the `ondatachannel` event handler.