Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 90c290e

Browse files
committed
Moving to WebTransport over HTTP/3.
This change updates the QUIC SDK to support WebTransport over HTTP/3.
1 parent bca4ebb commit 90c290e

11 files changed

+62
-61
lines changed

doc/design/quic-programming-guide.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Overview
55

6-
OWT QUIC SDK and Client SDKs provides the APIs for enabling QUIC Transport for reliable data transmission over QUIC protocol with OWT Conference Server.
6+
OWT QUIC SDK and Client SDKs provides the APIs for enabling WebTransport for reliable data transmission over QUIC protocol with OWT Conference Server.
77

88
# Scope
99

@@ -12,7 +12,7 @@ This document describes the programming models and API interfaces for following
1212
- Deploying a QUIC conference server that is capable of forwarding data over QUIC channel.
1313
- Implementing client application that is capable of sending data to QUIC server or receiving data from it.
1414

15-
Description of the details of QUIC transport is outside the scope of this document.
15+
Description of the details of WebTransport is outside the scope of this document.
1616

1717
# Related Repos
1818

@@ -29,19 +29,19 @@ The topology of components is shown in below diagram:
2929

3030
![plot](./pics/quic_block_diagram.png)
3131

32-
There are a few components involved and their relationships with streaming using QuicTransport are described as below:
32+
There are a few components involved and their relationships with streaming using WebTransport are described as below:
3333

3434
## OWT QUIC C++ SDK
3535

36-
This is the foundation of QUIC implementation in OWT. It provides the APIs to create QUIC transport clients and server forming a C/S architecture. Basically you can directly build your QUICTransport applications using the QUIC C++ SDK client API if you're not using the OWT native SDK.
36+
This is the foundation of WebTransport implementation in OWT. It provides the APIs to create WebTransport over HTTP/3 clients and server forming a C/S architecture. Basically you can directly build your WebTransport applications using the QUIC C++ SDK client API if you're not using the OWT native SDK.
3737

3838
## OWT Native SDK for Conference
3939

40-
The OWT conference SDK built upon OWT QUIC C++ SDK client API. It is used in combination with OWT QUIC conference server when you rely on OWT signaling protocol for QUIC connection setup as well as stream forwarding.
40+
The OWT conference SDK built upon OWT QUIC C++ SDK client API. It is used in combination with OWT QUIC conference server when you rely on OWT signaling protocol for WebTransport connection setup as well as stream forwarding.
4141

4242
## OWT QUIC Conference Server
4343

44-
The OWT QUIC conference server implements the signaling protocol for QUIC connection setup, as well as QUIC stream forwarding.
44+
The OWT QUIC conference server implements the signaling protocol for WebTransport connection setup, as well as QUIC stream forwarding.
4545

4646
## OWT QUIC JavaScript SDK
4747

@@ -63,33 +63,33 @@ The server API calling flow is shown in below diagram and table.
6363

6464
| Step # | API calling flow |
6565
| --- | --- |
66-
| 1 | Application calls the factory method of QuicTransportFactory::Create() to get an instance of QuicTransportFactory |
67-
| 2 | Application calls QuicTransportFactory::CreateQuicTransportServer() on the QuicTransportFactory instance got in step #1, specifying the server port, certificate path either in the form of .pkcs12 or .pfx format. |
68-
| 3 | Application Creates the Visitor instance of QuicTransportServerInterface |
69-
| 4 | Application calls SetVisitor on the QuicTransportServerInterface instance got in step #2. |
70-
| 5 | Application calls Start() method on the QuicTransportServerInterface instance got in step #2 |
71-
| 6 | OnSession() callback will be invoked once the quictransportserver gets a connection request from client, and an QuicTransportSession instance is passed from the callback. |
72-
| 7 | Application calls CreateBidirectionalStream on the QuicTransportSession got in step 6 and get a QuicTransportStreamInterface instance. |
73-
| 8 | Application creates QuicTransportStream::Visitor instance and invokes QuicTransportStreamInterface::SetVisitor(). |
74-
| 9 | Application reads the QuicTransportStream when OnCanRead is invoked on the QuicTransportStream::Visitor; or write to the QuicTransportStream when OnCanWrite is invoked on the QuicTransportStreamVisitor; |
66+
| 1 | Application calls the factory method of WebTransportFactory::Create() to get an instance of WebTransportFactory |
67+
| 2 | Application calls WebTransportFactory::CreateWebTransportServer() on the WebTransportFactory instance got in step #1, specifying the server port, certificate path either in the form of .pkcs12 or .pfx format. |
68+
| 3 | Application Creates the Visitor instance of WebTransportServerInterface |
69+
| 4 | Application calls SetVisitor on the WebTransportServerInterface instance got in step #2. |
70+
| 5 | Application calls Start() method on the WebTransportServerInterface instance got in step #2 |
71+
| 6 | OnSession() callback will be invoked once the WebTransportserver gets a connection request from client, and an WebTransportSession instance is passed from the callback. |
72+
| 7 | Application calls CreateBidirectionalStream on the WebTransportSession got in step 6 and get a WebTransportStreamInterface instance. |
73+
| 8 | Application creates WebTransportStream::Visitor instance and invokes WebTransportStreamInterface::SetVisitor(). |
74+
| 9 | Application reads the WebTransportStream when OnCanRead is invoked on the WebTransportStream::Visitor; or write to the WebTransportStream when OnCanWrite is invoked on the WebTransportStreamVisitor; |
7575

7676
## OWT QUIC C++ SDK Client API Calling Flow
7777

78-
The client API calling flow is shown in below diagram and table. It's similar as the server side calling flow except the QuicTransportFactory creates a QuicTransportClientInterface, instead of a QUICTransportServerInterface, and client needs to call Connect() instead of Start() to get a QuicTransportSession.
78+
The client API calling flow is shown in below diagram and table. It's similar as the server side calling flow except the WebTransportFactory creates a WebTransportClientInterface, instead of a WebTransportServerInterface, and client needs to call Connect() instead of Start() to get a WebTransportSession.
7979

8080
![plot](./pics/client_API.png)
8181

8282
| Step # | API calling flow |
8383
| --- | --- |
84-
| 1 | Application calls the factory method of QuicTransportFactory::Create() to get an instance of QuicTransportFactory |
85-
| 2 | Application calls QuicTransportFactory::CreateQuicTransportClient() on the QuicTransportFactory instance got in step #1, specifying the server URL to connect to. |
86-
| 3 | Application Creates the Visitor instance of QuicTransportClientInterface |
87-
| 4 | Application calls SetVisitor on the QuicTransportClientInterface instance got in step #2. |
88-
| 5 | Application calls Connect() method on the QuicTransportClientInterface instance got in step #2, passing the URL of the server. |
89-
| 6 | OnSession() callback will be invoked once the quictransportclient successfully connects to server, and an QuicTransportSession instance is passed from the callback. |
90-
| 7 | Application calls CreateBidirectionalStream on the QuicTransportSession got in step 6 and get a QuicTransportStreamInterface instance. |
91-
| 8 | Application creates QuicTransportStream::Visitor instance and invokes QuicTransportStreamInterface::SetVisitor(). |
92-
| 9 | Application reads the QuicTransportStream when OnCanRead is invoked on the QuicTransportStream::Visitor; or write to the QuicTransportStream when OnCanWrite is invoked on the QuicTransportStreamVisitor; |
84+
| 1 | Application calls the factory method of WebTransportFactory::Create() to get an instance of WebTransportFactory |
85+
| 2 | Application calls WebTransportFactory::CreateWebTransportClient() on the WebTransportFactory instance got in step #1, specifying the server URL to connect to. |
86+
| 3 | Application Creates the Visitor instance of WebTransportClientInterface |
87+
| 4 | Application calls SetVisitor on the WebTransportClientInterface instance got in step #2. |
88+
| 5 | Application calls Connect() method on the WebTransportClientInterface instance got in step #2, passing the URL of the server. |
89+
| 6 | OnSession() callback will be invoked once the WebTransportclient successfully connects to server, and an WebTransportSession instance is passed from the callback. |
90+
| 7 | Application calls CreateBidirectionalStream on the WebTransportSession got in step 6 and get a WebTransportStreamInterface instance. |
91+
| 8 | Application creates WebTransportStream::Visitor instance and invokes WebTransportStreamInterface::SetVisitor(). |
92+
| 9 | Application reads the WebTransportStream when OnCanRead is invoked on the WebTransportStream::Visitor; or write to the WebTransportStream when OnCanWrite is invoked on the WebTransportStreamVisitor; |
9393

9494
## Details of Callbacks and Data Structures of QUIC C++ SDK
9595

@@ -139,7 +139,7 @@ The Windows sample will be provided in OWT repo separately. More details will be
139139

140140
# How to Replace the Certificate for QUIC
141141

142-
OWT Conference Server is using a self-signed certificate during development phase, which would be only valid for 14 days. You can use a CA-signed certificate to avoid refreshing the certificate periodically. QUIC connection will fail if certificate is not valid or expires.
142+
OWT Conference Server is using a self-signed certificate during development phase, which would be only valid for 14 days. You can use a CA-signed certificate to avoid refreshing the certificate periodically. WebTransport connection will fail if certificate is not valid or expires.
143143

144144
## Precondition
145145

source/agent/addons/quic/QuicFactory.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
#include "QuicFactory.h"
8-
#include "owt/quic/quic_transport_factory.h"
8+
#include "owt/quic/web_transport_factory.h"
99
#include <mutex>
1010

1111
DEFINE_LOGGER(QuicFactory, "QuicFactory");
@@ -15,11 +15,11 @@ std::once_flag getQuicFactoryOnce;
1515
std::shared_ptr<QuicFactory> QuicFactory::s_quicFactory = nullptr;
1616

1717
QuicFactory::QuicFactory()
18-
: m_quicTransportFactory(std::shared_ptr<owt::quic::QuicTransportFactory>(owt::quic::QuicTransportFactory::Create()))
18+
: m_quicTransportFactory(std::shared_ptr<owt::quic::WebTransportFactory>(owt::quic::WebTransportFactory::Create()))
1919
{
2020
}
2121

22-
std::shared_ptr<owt::quic::QuicTransportFactory> QuicFactory::getQuicTransportFactory()
22+
std::shared_ptr<owt::quic::WebTransportFactory> QuicFactory::getQuicTransportFactory()
2323
{
2424
std::call_once(getQuicFactoryOnce, []() {
2525
QuicFactory* factory = new QuicFactory();

source/agent/addons/quic/QuicFactory.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
namespace owt {
1414
namespace quic {
15-
class QuicTransportFactory;
15+
class WebTransportFactory;
1616
}
1717
}
1818

1919
class QuicFactory {
2020
public:
2121
DECLARE_LOGGER();
2222
virtual ~QuicFactory() = default;
23-
static std::shared_ptr<owt::quic::QuicTransportFactory> getQuicTransportFactory();
23+
static std::shared_ptr<owt::quic::WebTransportFactory> getQuicTransportFactory();
2424

2525
private:
2626
explicit QuicFactory();
2727

2828
static std::shared_ptr<QuicFactory> s_quicFactory;
29-
std::shared_ptr<owt::quic::QuicTransportFactory> m_quicTransportFactory;
29+
std::shared_ptr<owt::quic::WebTransportFactory> m_quicTransportFactory;
3030
};
3131

3232
#endif

source/agent/addons/quic/QuicTransportConnection.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void QuicTransportConnection::setVisitor(Visitor* visitor)
5050
m_visitor = visitor;
5151
}
5252

53-
void QuicTransportConnection::OnIncomingStream(owt::quic::QuicTransportStreamInterface* stream)
53+
void QuicTransportConnection::OnIncomingStream(owt::quic::WebTransportStreamInterface* stream)
5454
{
5555
ELOG_DEBUG("OnIncomingStream.");
5656
{
@@ -77,7 +77,7 @@ NAN_METHOD(QuicTransportConnection::newInstance)
7777
info.GetReturnValue().Set(info.This());
7878
}
7979

80-
v8::Local<v8::Object> QuicTransportConnection::newInstance(owt::quic::QuicTransportSessionInterface* session)
80+
v8::Local<v8::Object> QuicTransportConnection::newInstance(owt::quic::WebTransportSessionInterface* session)
8181
{
8282
Local<Object> connectionObject = Nan::NewInstance(Nan::New(QuicTransportConnection::s_constructor)).ToLocalChecked();
8383
QuicTransportConnection* obj = Nan::ObjectWrap::Unwrap<QuicTransportConnection>(connectionObject);

source/agent/addons/quic/QuicTransportConnection.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#include <nan.h>
1717

1818
#include "QuicTransportStream.h"
19-
#include "owt/quic/quic_transport_session_interface.h"
19+
#include "owt/quic/web_transport_session_interface.h"
2020

21-
class QuicTransportConnection : public Nan::ObjectWrap, public owt::quic::QuicTransportSessionInterface::Visitor, QuicTransportStream::Visitor {
21+
class QuicTransportConnection : public Nan::ObjectWrap, public owt::quic::WebTransportSessionInterface::Visitor, QuicTransportStream::Visitor {
2222
DECLARE_LOGGER();
2323

2424
public:
@@ -31,7 +31,7 @@ class QuicTransportConnection : public Nan::ObjectWrap, public owt::quic::QuicTr
3131
explicit QuicTransportConnection();
3232
~QuicTransportConnection();
3333
void setVisitor(Visitor* visitor);
34-
static v8::Local<v8::Object> newInstance(owt::quic::QuicTransportSessionInterface* session);
34+
static v8::Local<v8::Object> newInstance(owt::quic::WebTransportSessionInterface* session);
3535

3636
static NAN_MODULE_INIT(init);
3737
static NAN_METHOD(newInstance);
@@ -41,15 +41,16 @@ class QuicTransportConnection : public Nan::ObjectWrap, public owt::quic::QuicTr
4141
static Nan::Persistent<v8::Function> s_constructor;
4242

4343
protected:
44-
// Overrides owt::quic::QuicTransportSessionInterface::Visitor.
45-
void OnIncomingStream(owt::quic::QuicTransportStreamInterface*) override;
44+
// Overrides owt::quic::WebTransportSessionInterface::Visitor.
45+
void OnIncomingStream(owt::quic::WebTransportStreamInterface*) override;
4646
void OnCanCreateNewOutgoingStream(bool unidirectional) override { }
47+
void OnConnectionClosed() override { }
4748

4849
// Overrides QuicTransportStream::Visitor.
4950
void onEnded() override;
5051

5152
private:
52-
owt::quic::QuicTransportSessionInterface* m_session;
53+
owt::quic::WebTransportSessionInterface* m_session;
5354
Visitor* m_visitor;
5455
// Key is content session ID, i.e.: publication ID, subscription ID.
5556
std::unordered_map<std::string, std::unique_ptr<QuicTransportStream>> m_streams;
@@ -58,7 +59,7 @@ class QuicTransportConnection : public Nan::ObjectWrap, public owt::quic::QuicTr
5859

5960
uv_async_t m_asyncOnStream;
6061
std::mutex m_streamQueueMutex;
61-
std::queue<owt::quic::QuicTransportStreamInterface*> m_streamsToBeNotified;
62+
std::queue<owt::quic::WebTransportStreamInterface*> m_streamsToBeNotified;
6263
};
6364

6465
#endif

source/agent/addons/quic/QuicTransportServer.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "QuicFactory.h"
99
#include "QuicTransportStream.h"
1010
#include "Utils.h"
11-
#include "owt/quic/quic_transport_factory.h"
12-
#include "owt/quic/quic_transport_session_interface.h"
11+
#include "owt/quic/web_transport_factory.h"
12+
#include "owt/quic/web_transport_session_interface.h"
1313

1414
using v8::Function;
1515
using v8::FunctionTemplate;
@@ -23,7 +23,7 @@ Nan::Persistent<v8::Function> QuicTransportServer::s_constructor;
2323
DEFINE_LOGGER(QuicTransportServer, "QuicTransportServer");
2424

2525
QuicTransportServer::QuicTransportServer(int port, const std::string& pfxPath, const std::string& password)
26-
: m_quicServer(QuicFactory::getQuicTransportFactory()->CreateQuicTransportServer(port, pfxPath.c_str(), password.c_str()))
26+
: m_quicServer(QuicFactory::getQuicTransportFactory()->CreateWebTransportServer(port, pfxPath.c_str(), password.c_str()))
2727
{
2828
m_quicServer->SetVisitor(this);
2929
ELOG_DEBUG("QuicTransportServer::QuicTransportServer");
@@ -113,7 +113,7 @@ void QuicTransportServer::OnEnded()
113113
ELOG_DEBUG("QuicTransport server ended.");
114114
}
115115

116-
void QuicTransportServer::OnSession(owt::quic::QuicTransportSessionInterface* session)
116+
void QuicTransportServer::OnSession(owt::quic::WebTransportSessionInterface* session)
117117
{
118118
ELOG_DEBUG("New session created. Connection ID: %s.", session->ConnectionId());
119119
{

source/agent/addons/quic/QuicTransportServer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
#define QUIC_QUICTRANSPORTSERVER_H_
99

1010
#include "QuicTransportConnection.h"
11-
#include "owt/quic/quic_transport_server_interface.h"
11+
#include "owt/quic/web_transport_server_interface.h"
1212
#include <logger.h>
1313
#include <mutex>
1414
#include <nan.h>
1515
#include <string>
1616
#include <unordered_map>
1717

18-
class QuicTransportServer : public Nan::ObjectWrap, owt::quic::QuicTransportServerInterface::Visitor, QuicTransportConnection::Visitor {
18+
class QuicTransportServer : public Nan::ObjectWrap, owt::quic::WebTransportServerInterface::Visitor, QuicTransportConnection::Visitor {
1919
DECLARE_LOGGER();
2020

2121
public:
2222
static NAN_MODULE_INIT(init);
2323

2424
protected:
25-
// Overrides owt::quic::QuicTransportServerInterface::Visitor.
25+
// Overrides owt::quic::WebTransportServerInterface::Visitor.
2626
void OnEnded() override;
27-
void OnSession(owt::quic::QuicTransportSessionInterface*) override;
27+
void OnSession(owt::quic::WebTransportSessionInterface*) override;
2828

2929
// Overrides QuicTransportConnection::Visitor.
3030
void onAuthentication(const std::string& id) override;
@@ -40,11 +40,11 @@ class QuicTransportServer : public Nan::ObjectWrap, owt::quic::QuicTransportServ
4040
static NAN_METHOD(stop);
4141
static NAUV_WORK_CB(onConnectionCallback);
4242

43-
std::unique_ptr<owt::quic::QuicTransportServerInterface> m_quicServer;
43+
std::unique_ptr<owt::quic::WebTransportServerInterface> m_quicServer;
4444

4545
uv_async_t m_asyncOnConnection;
4646
std::mutex m_connectionQueueMutex;
47-
std::queue<owt::quic::QuicTransportSessionInterface*> m_connectionsToBeNotified;
47+
std::queue<owt::quic::WebTransportSessionInterface*> m_connectionsToBeNotified;
4848

4949
static Nan::Persistent<v8::Function> s_constructor;
5050
};

source/agent/addons/quic/QuicTransportStream.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ QuicTransportStream::QuicTransportStream()
2323
: QuicTransportStream(nullptr)
2424
{
2525
}
26-
QuicTransportStream::QuicTransportStream(owt::quic::QuicTransportStreamInterface* stream)
26+
QuicTransportStream::QuicTransportStream(owt::quic::WebTransportStreamInterface* stream)
2727
: m_stream(stream)
2828
, m_contentSessionId()
2929
, m_receivedContentSessionId(false)
@@ -129,7 +129,7 @@ NAN_METHOD(QuicTransportStream::removeDestination)
129129
{
130130
}
131131

132-
v8::Local<v8::Object> QuicTransportStream::newInstance(owt::quic::QuicTransportStreamInterface* stream)
132+
v8::Local<v8::Object> QuicTransportStream::newInstance(owt::quic::WebTransportStreamInterface* stream)
133133
{
134134
Local<Object> streamObject = Nan::NewInstance(Nan::New(QuicTransportStream::s_constructor)).ToLocalChecked();
135135
QuicTransportStream* obj = Nan::ObjectWrap::Unwrap<QuicTransportStream>(streamObject);

source/agent/addons/quic/QuicTransportStream.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#ifndef QUIC_QUICTRANSPORTSTREAM_H_
88
#define QUIC_QUICTRANSPORTSTREAM_H_
99

10-
#include "owt/quic/quic_transport_stream_interface.h"
10+
#include "owt/quic/web_transport_stream_interface.h"
1111
#include "../../core/owt_base/MediaFramePipeline.h"
1212
#include <logger.h>
1313
#include <nan.h>
1414
#include <mutex>
1515
#include <string>
1616

17-
class QuicTransportStream : public owt_base::FrameSource, public owt_base::FrameDestination, public Nan::ObjectWrap, public owt::quic::QuicTransportStreamInterface::Visitor {
17+
class QuicTransportStream : public owt_base::FrameSource, public owt_base::FrameDestination, public Nan::ObjectWrap, public owt::quic::WebTransportStreamInterface::Visitor {
1818
DECLARE_LOGGER();
1919

2020
public:
@@ -24,10 +24,10 @@ class QuicTransportStream : public owt_base::FrameSource, public owt_base::Frame
2424
};
2525
explicit QuicTransportStream();
2626
// `sessionId` is the ID of publication or subscription, NOT the ID of QUIC session.
27-
explicit QuicTransportStream(owt::quic::QuicTransportStreamInterface* stream);
27+
explicit QuicTransportStream(owt::quic::WebTransportStreamInterface* stream);
2828
virtual ~QuicTransportStream();
2929

30-
static v8::Local<v8::Object> newInstance(owt::quic::QuicTransportStreamInterface* stream);
30+
static v8::Local<v8::Object> newInstance(owt::quic::WebTransportStreamInterface* stream);
3131

3232
static NAN_MODULE_INIT(init);
3333
static NAN_METHOD(newInstance);
@@ -48,7 +48,7 @@ class QuicTransportStream : public owt_base::FrameSource, public owt_base::Frame
4848
static Nan::Persistent<v8::Function> s_constructor;
4949

5050
protected:
51-
// Overrides owt::quic::QuicTransportStreamInterface::Visitor.
51+
// Overrides owt::quic::WebTransportStreamInterface::Visitor.
5252
void OnCanRead() override;
5353
void OnCanWrite() override;
5454
void OnFinRead() override;
@@ -59,7 +59,7 @@ class QuicTransportStream : public owt_base::FrameSource, public owt_base::Frame
5959
void SignalOnData();
6060
void ReallocateBuffer(size_t size);
6161

62-
owt::quic::QuicTransportStreamInterface* m_stream;
62+
owt::quic::WebTransportStreamInterface* m_stream;
6363
std::vector<uint8_t> m_contentSessionId;
6464
bool m_receivedContentSessionId;
6565
// True if it's piped to a receiver in C++ layer. In this case, data will not be sent to JavaScript code.

0 commit comments

Comments
 (0)