Skip to content

Commit

Permalink
Merge branch 'draft-06' into impl/subgroup_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
tetter27 committed Oct 30, 2024
2 parents aa122f6 + 61d2f50 commit 3516617
Show file tree
Hide file tree
Showing 38 changed files with 3,266 additions and 440 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ Supported version: draft-ietf-moq-transport-06
- [x] ANNOUNCE_ERROR
- [ ] ANNOUNCE_CANCEL
- [ ] TRACK_STATUS_REQUEST
- [ ] SUBSCRIBE_NAMESPACE
- [x] SUBSCRIBE_NAMESPACE
- [ ] UNSUBSCRIBE_NAMESPACE
- [x] SUBSCRIBE_OK
- [ ] SUBSCRIBE_ERROR
- [x] SUBSCRIBE_ERROR
- [ ] SUBSCRIBE_DONE
- [ ] MAX_SUBSCRIBE_ID
- [x] ANNOUNCE
- [ ] UNANNOUNCE
- [ ] TRACK_STATUS
- [ ] SUBSCRIBE_NAMESPACE_OK
- [ ] SUBSCRIBE_NAMESPACE_ERROR
- [x] SUBSCRIBE_NAMESPACE_OK
- [x] SUBSCRIBE_NAMESPACE_ERROR
- [ ] Data Streams
- [ ] Object Datagram Message
- [x] Track Stream
Expand Down
2 changes: 2 additions & 0 deletions js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ <h2>Message Type</h2>
<br />
<label><input type="radio" name="message-type" id="" value="subscribe" />SUBSCRIBE</label>
<label><input type="radio" name="message-type" id="" value="unsubscribe" />UNSUBSCRIBE</label>
<br />
<label><input type="radio" name="message-type" id="" value="subscribe-namespace" />SUBSCRIBE_NAMESPACE</label>
<div>
<!-- <label>Supported versions: <input type="text" name="versions" id="" value="0xc0000000ff000001"></label> -->
<label>Supported versions: <input type="text" name="versions" id="" value="0xff000006" /></label>
Expand Down
25 changes: 23 additions & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,18 @@ init().then(async () => {

client.onAnnounce(async (announceMessage) => {
console.log({ announceMessage })
let announcedNamespace = announceMessage.track_namespace

await client.sendAnnounceOkMessage(announcedNamespace)
})

client.onAnnounceResponce(async (announceResponceMessage) => {
console.log({ announceResponceMessage })
})

client.onSubscribe(async (subscribeMessage, isSuccess, code) => {
console.log({ subscribeMessage })
let subscribeId = BigInt(subscribeMessage.subscribe_id)
if (isSuccess) {
let expire = 0n
subscribeId = BigInt(subscribeMessage.subscribe_id)
Expand All @@ -37,14 +45,20 @@ init().then(async () => {

await client.sendSubscribeOkMessage(subscribeId, expire, authInfo)
} else {
// TODO: send subscribe error
// TODO: set accurate reasonPhrase
let reasonPhrase = 'subscribe error'
await client.sendSubscribeError(subscribeMessage.subscribe_id, code, reasonPhrase)
}
})

client.onSubscribeResponse(async (subscribeResponse) => {
console.log({ subscribeResponse })
})

client.onSubscribeNamespaceResponse(async (subscribeNamespaceResponse) => {
console.log({ subscribeNamespaceResponse })
})

client.onStreamHeaderTrack(async (streamHeaderTrack) => {
console.log({ streamHeaderTrack })
})
Expand Down Expand Up @@ -83,7 +97,7 @@ init().then(async () => {
await client.sendSetupMessage(role, versions, maxSubscribeId)
break
case 'announce':
await client.sendAnnounceMessage(trackNamespace, 1, authInfo)
await client.sendAnnounceMessage(trackNamespace, authInfo)
break
case 'unannounce':
await client.sendUnannounceMessage(trackNamespace)
Expand All @@ -94,14 +108,21 @@ init().then(async () => {
case 'unsubscribe':
await client.sendUnsubscribeMessage(trackNamespace, trackName)
break
case 'subscribe-namespace':
await client.sendSubscribeNamespaceMessage(trackNamespace, authInfo)
break
case 'object-track':
if (!headerSend) {
await client.sendStreamHeaderTrackMessage(subscribeId, trackAlias, 0)
headerSend = true
}
let groupId = 0n
<<<<<<< HEAD
objectPayload = new Uint8Array([0xde, 0xad, 0xbe, 0xef])
// let objectPayload = new Uint8Array([0x00, 0x01, 0x02, 0x03])
=======
let objectPayload = new Uint8Array([0xde, 0xad, 0xbe, 0xef])
>>>>>>> draft-06
await client.sendObjectStreamTrack(subscribeId, groupId, objectId++, objectPayload)
break
case 'object-subgroup':
Expand Down
Loading

0 comments on commit 3516617

Please sign in to comment.