Skip to content

Commit e837ff2

Browse files
authored
Add datachannels to openapi spec (#22638)
1 parent b34c9a6 commit e837ff2

File tree

1 file changed

+282
-1
lines changed

1 file changed

+282
-1
lines changed

public/realtime/static/calls-api-2024-05-21.yaml

Lines changed: 282 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,202 @@ paths:
432432
- mid: "7"
433433
sessionId: "2a45361d5fd7cc14eface0587c276c94"
434434
trackName: "new-track-name"
435-
435+
/apps/{appId}/sessions/{sessionId}/datachannels/establish:
436+
post:
437+
tags:
438+
- Establish a data channel transport
439+
summary: Pull a server events channel to establish a data channel transport. It only allows to pull the server-events channel
440+
requestBody:
441+
content:
442+
application/json:
443+
schema:
444+
$ref: "#/components/schemas/EstablishDataChannelsTransportRequest"
445+
examples:
446+
ask_for_an_offer:
447+
description: Ask for an offer to pull the server-events channel
448+
value:
449+
datachannel:
450+
location: remote
451+
dataChannelName: server-events
452+
send_an_offer:
453+
description: Send an offer with an application media section to pull the server-events channel
454+
value:
455+
datachannel:
456+
location: remote
457+
dataChannelName: server-events
458+
sessionDescription:
459+
sdp: |
460+
v=0
461+
o=- 0 0 IN IP4 127.0.0.1
462+
s=-
463+
c=IN IP4 127.0.0.1
464+
t=0 0
465+
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
466+
...
467+
type: offer
468+
security:
469+
- secret: []
470+
parameters:
471+
- in: path
472+
name: appId
473+
schema:
474+
type: string
475+
required: true
476+
description: WebRTC application ID
477+
- in: path
478+
name: sessionId
479+
schema:
480+
type: string
481+
required: true
482+
description: Current PeerConnection session ID
483+
responses:
484+
"200":
485+
description: OK
486+
headers:
487+
vary:
488+
schema:
489+
type: string
490+
example: Origin
491+
content:
492+
application/json:
493+
schema:
494+
$ref: "#/components/schemas/EstablishDataChannelsTransportResponse"
495+
examples:
496+
ask_for_an_offer:
497+
value:
498+
requiresImmediateRenegotiation: true
499+
datachannel:
500+
location: remote
501+
dataChannelName: server-events
502+
id: 0
503+
send_an_offer:
504+
value:
505+
requiresImmediateRenegotiation: false
506+
datachannel:
507+
location: remote
508+
dataChannelName: server-events
509+
id: 0
510+
sessionDescription:
511+
sdp: |
512+
v=0
513+
o=- 0 0 IN IP4 127.0.0.1
514+
s=-
515+
c=IN IP4 127.0.0.1
516+
t=0 0
517+
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
518+
...
519+
type: answer
520+
/apps/{appId}/sessions/{sessionId}/datachannels/new:
521+
post:
522+
tags:
523+
- Add data channel(s)
524+
summary: Solve the given data channel object(s) and add the data channel(s) to the WebRTC session. It requires to have a data channels transport established
525+
requestBody:
526+
content:
527+
application/json:
528+
schema:
529+
$ref: "#/components/schemas/DataChannelsRequest"
530+
examples:
531+
local_datachannels:
532+
description: Share a data channel to be consumed by remote peers
533+
value:
534+
datachannels:
535+
- location: local
536+
dataChannelName: 1a037563-c35c-4bf6-a9ee-2b474cbb9a51
537+
remote_datachannels:
538+
description: Consume a remote data channel
539+
value:
540+
datachannels:
541+
- location: remote
542+
sessionId: "2a45361d5fd7cc14eface0587c276c94"
543+
dataChannelName: 1a037563-c35c-4bf6-a9ee-2b474cbb9a51
544+
security:
545+
- secret: []
546+
parameters:
547+
- in: path
548+
name: appId
549+
schema:
550+
type: string
551+
required: true
552+
description: WebRTC application ID
553+
- in: path
554+
name: sessionId
555+
schema:
556+
type: string
557+
required: true
558+
description: Current PeerConnection session ID
559+
responses:
560+
"200":
561+
description: OK
562+
headers:
563+
vary:
564+
schema:
565+
type: string
566+
example: Origin
567+
content:
568+
application/json:
569+
schema:
570+
$ref: "#/components/schemas/DataChannelsResponse"
571+
examples:
572+
local_datachannels:
573+
value:
574+
datachannels:
575+
- dataChannelName: 1a037563-c35c-4bf6-a9ee-2b474cbb9a51
576+
location: local
577+
id: 3
578+
remote_datachannels:
579+
value:
580+
datachannels:
581+
- sessionId: 2a45361d5fd7cc14eface0587c276c94
582+
location: remote
583+
dataChannelName: 1a037563-c35c-4bf6-a9ee-2b474cbb9a51
584+
id: 4
585+
/apps/{appId}/sessions/{sessionId}/datachannels/close:
586+
put:
587+
tags:
588+
- Close data channel(s)
589+
summary: Close local or remote data channel(s)
590+
requestBody:
591+
content:
592+
application/json:
593+
schema:
594+
allOf:
595+
- $ref: "#/components/schemas/CloseDataChannelsRequest"
596+
- example:
597+
datachannels:
598+
- id: 2
599+
security:
600+
- secret: []
601+
parameters:
602+
- in: path
603+
name: appId
604+
schema:
605+
type: string
606+
required: true
607+
description: WebRTC application ID
608+
- in: path
609+
name: sessionId
610+
schema:
611+
type: string
612+
required: true
613+
responses:
614+
"200":
615+
description: OK
616+
headers:
617+
vary:
618+
schema:
619+
type: string
620+
example: Origin
621+
content:
622+
application/json:
623+
schema:
624+
$ref: "#/components/schemas/CloseDataChannelsResponse"
625+
example:
626+
datachannels:
627+
- location: remote
628+
sessionId: 2a45361d5fd7cc14eface0587c276c94
629+
dataChannelName: 1a037563-c35c-4bf6-a9ee-2b474cbb9a51
630+
id: 2
436631
/apps/{appId}/sessions/{sessionId}:
437632
get:
438633
tags:
@@ -709,3 +904,89 @@ components:
709904
errorDescription:
710905
type: string
711906
description: Array of track objects with results
907+
DataChannelObject:
908+
type: object
909+
properties:
910+
location:
911+
type: string
912+
enum:
913+
- local
914+
- remote
915+
description: Choose local to broadcast into the given dataChannelName. Choose remote to consume a broadcast from someone else
916+
sessionId:
917+
type: string
918+
description: Session ID of the data channel owner. It should be set for remote data channels only
919+
dataChannelName:
920+
type: string
921+
description: Given name for the data channel
922+
id:
923+
type: number
924+
description: Data channel id
925+
DataChannelsRequest:
926+
type: object
927+
properties:
928+
dataChannels:
929+
type: array
930+
items:
931+
$ref: "#/components/schemas/DataChannelObject"
932+
DataChannelsResponse:
933+
type: object
934+
properties:
935+
errorCode:
936+
type: string
937+
errorDescription:
938+
type: string
939+
dataChannels:
940+
type: array
941+
items:
942+
allOf:
943+
- $ref: "#/components/schemas/DataChannelObject"
944+
- properties:
945+
errorCode:
946+
type: string
947+
errorDescription:
948+
type: string
949+
EstablishDataChannelsTransportRequest:
950+
type: object
951+
properties:
952+
sessionDescription:
953+
$ref: "#/components/schemas/SessionDescription"
954+
dataChannel:
955+
$ref: "#/components/schemas/DataChannelObject"
956+
EstablishDataChannelsTransportResponse:
957+
type: object
958+
properties:
959+
errorCode:
960+
type: string
961+
errorDescription:
962+
type: string
963+
sessionDescription:
964+
$ref: "#/components/schemas/SessionDescription"
965+
requiresImmediateRenegotiation:
966+
type: boolean
967+
dataChannel:
968+
$ref: "#/components/schemas/DataChannelObject"
969+
CloseDataChannelsRequest:
970+
type: object
971+
properties:
972+
dataChannels:
973+
type: array
974+
items:
975+
$ref: "#/components/schemas/DataChannelObject"
976+
CloseDataChannelsResponse:
977+
type: object
978+
properties:
979+
errorCode:
980+
type: string
981+
errorDescription:
982+
type: string
983+
dataChannels:
984+
type: array
985+
items:
986+
allOf:
987+
- $ref: "#/components/schemas/DataChannelObject"
988+
- properties:
989+
errorCode:
990+
type: string
991+
errorDescription:
992+
type: string

0 commit comments

Comments
 (0)