Small tweak to middleware docs
@@ -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.
