mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-12 13:50:01 -04:00
monorepo part 2
This commit is contained in:
parent
2138e02613
commit
6dc4aa8c6b
17 changed files with 165 additions and 66 deletions
17
client/package.json
Normal file
17
client/package.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "client",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "src/index.ts",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"bare-client-custom": "file:../bare-client-custom",
|
||||||
|
"firebase": "^10.1.0",
|
||||||
|
"protocol": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import {
|
||||||
ReadyStateCallback,
|
ReadyStateCallback,
|
||||||
WebSocketImpl,
|
WebSocketImpl,
|
||||||
} from "bare-client-custom";
|
} from "bare-client-custom";
|
||||||
import Connection from "./Connection";
|
import { Connection } from "./Connection";
|
||||||
|
|
||||||
// export class Adrift {
|
// export class Adrift {
|
||||||
// bareclient:AdriftBareClient,
|
// bareclient:AdriftBareClient,
|
||||||
|
@ -45,7 +45,7 @@ export class AdriftBareClient extends Client {
|
||||||
});
|
});
|
||||||
const headers = new Headers();
|
const headers = new Headers();
|
||||||
for (const [header, values] of Object.entries(payload.headers)) {
|
for (const [header, values] of Object.entries(payload.headers)) {
|
||||||
for (const value of values) {
|
for (const value of <string[]>values) {
|
||||||
headers.append(header, value);
|
headers.append(header, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,10 +5,10 @@ import {
|
||||||
HTTPResponsePayload,
|
HTTPResponsePayload,
|
||||||
S2CRequestType,
|
S2CRequestType,
|
||||||
S2CRequestTypes,
|
S2CRequestTypes,
|
||||||
} from "../protocol";
|
Transport,
|
||||||
import Transport from "../protocol/Transport";
|
} from "protocol";
|
||||||
|
|
||||||
export default class Connection {
|
export class Connection {
|
||||||
callbacks: Record<number, Function> = {};
|
callbacks: Record<number, Function> = {};
|
||||||
|
|
||||||
counter: number = 0;
|
counter: number = 0;
|
|
@ -1,9 +1,9 @@
|
||||||
import Transport from "../protocol/Transport";
|
import { Transport } from "protocol";
|
||||||
|
|
||||||
export class DevWsTransport extends Transport {
|
export class DevWsTransport extends Transport {
|
||||||
ws: WebSocket;
|
ws: WebSocket;
|
||||||
|
|
||||||
constructor(onopen, onclose) {
|
constructor(onopen: () => void, onclose: () => void) {
|
||||||
super(onopen, onclose);
|
super(onopen, onclose);
|
||||||
|
|
||||||
this.ws = new WebSocket("ws://localhost:3000/dev-ws");
|
this.ws = new WebSocket("ws://localhost:3000/dev-ws");
|
|
@ -1,39 +1,38 @@
|
||||||
import Transport from "../protocol/Transport";
|
import { Transport } from "protocol";
|
||||||
import Connection from "./Connection";
|
|
||||||
|
|
||||||
const rtcConf = {
|
const rtcConf = {
|
||||||
iceServers: [
|
iceServers: [
|
||||||
{
|
{
|
||||||
urls: "stun:stun.l.google.com:19302"
|
urls: "stun:stun.l.google.com:19302",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
};
|
||||||
|
|
||||||
enum RequestType {
|
enum RequestType {
|
||||||
HttpRequest,
|
HttpRequest,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Offer = { offer: any; localCandidates: any };
|
||||||
type Offer = { offer: any, localCandidates: any };
|
|
||||||
interface RTCOptions {
|
interface RTCOptions {
|
||||||
|
onconnectionstatechange?: any;
|
||||||
onconnectionstatechange?,
|
onsignalingstatechange?: any;
|
||||||
onsignalingstatechange?,
|
oniceconnectionstatechange?: any;
|
||||||
oniceconnectionstatechange?,
|
onicegatheringstatechange?: any;
|
||||||
onicegatheringstatechange?,
|
onopen?: any;
|
||||||
onopen?,
|
onclose?: any;
|
||||||
onclose?,
|
onmessage?: any;
|
||||||
onmessage?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RTCTransport extends Transport {
|
export class RTCTransport extends Transport {
|
||||||
peer: RTCPeerConnection;
|
peer: RTCPeerConnection;
|
||||||
|
|
||||||
dataChannel: RTCDataChannel;
|
dataChannel: RTCDataChannel;
|
||||||
constructor(onopen, onclose,
|
constructor(
|
||||||
|
public onopen: () => void,
|
||||||
|
public onclose: () => void,
|
||||||
public onconnectionstatechange: () => void,
|
public onconnectionstatechange: () => void,
|
||||||
public onsignalingstatechange: () => void,
|
public onsignalingstatechange: () => void,
|
||||||
public onicegatheringstatechange: () => void,
|
public onicegatheringstatechange: () => void
|
||||||
) {
|
) {
|
||||||
super(onopen, onclose);
|
super(onopen, onclose);
|
||||||
this.peer = new RTCPeerConnection(rtcConf);
|
this.peer = new RTCPeerConnection(rtcConf);
|
||||||
|
@ -41,22 +40,24 @@ export class RTCTransport extends Transport {
|
||||||
|
|
||||||
this.peer.onsignalingstatechange = onsignalingstatechange;
|
this.peer.onsignalingstatechange = onsignalingstatechange;
|
||||||
|
|
||||||
this.peer.oniceconnectionstatechange =
|
this.peer.oniceconnectionstatechange = (event) => {
|
||||||
(event) => {
|
console.log("ICE connection state:", this.peer.iceConnectionState);
|
||||||
console.log('ICE connection state:', this.peer.iceConnectionState);
|
if (
|
||||||
if (this.peer.iceConnectionState == "disconnected" || this.peer.iceConnectionState == "failed") {
|
this.peer.iceConnectionState == "disconnected" ||
|
||||||
console.log("disconnected");
|
this.peer.iceConnectionState == "failed"
|
||||||
onclose();
|
) {
|
||||||
}
|
console.log("disconnected");
|
||||||
};
|
onclose();
|
||||||
|
}
|
||||||
|
};
|
||||||
this.peer.onicegatheringstatechange = onicegatheringstatechange;
|
this.peer.onicegatheringstatechange = onicegatheringstatechange;
|
||||||
this.dataChannel = this.peer.createDataChannel('host-server');
|
this.dataChannel = this.peer.createDataChannel("host-server");
|
||||||
this.dataChannel.onopen = onopen;
|
this.dataChannel.onopen = onopen;
|
||||||
|
|
||||||
this.dataChannel.onclose = onclose;
|
this.dataChannel.onclose = onclose;
|
||||||
this.dataChannel.onmessage = async (event) => {
|
this.dataChannel.onmessage = async (event) => {
|
||||||
let buf = await event.data.arrayBuffer();
|
let buf = await event.data.arrayBuffer();
|
||||||
this.ondata(buf)
|
this.ondata(buf);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,15 +65,10 @@ export class RTCTransport extends Transport {
|
||||||
this.dataChannel.send(data);
|
this.dataChannel.send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async createOffer(): Promise<Promise<Offer>> {
|
async createOffer(): Promise<Promise<Offer>> {
|
||||||
|
|
||||||
const localCandidates: RTCIceCandidate[] = [];
|
const localCandidates: RTCIceCandidate[] = [];
|
||||||
|
|
||||||
|
|
||||||
let readyPromise: Promise<Offer> = new Promise((resolve, reject) => {
|
let readyPromise: Promise<Offer> = new Promise((resolve, reject) => {
|
||||||
|
|
||||||
this.peer.onicecandidate = async (event) => {
|
this.peer.onicecandidate = async (event) => {
|
||||||
if (event.candidate) {
|
if (event.candidate) {
|
||||||
localCandidates.push(event.candidate);
|
localCandidates.push(event.candidate);
|
||||||
|
@ -83,8 +79,6 @@ export class RTCTransport extends Transport {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const offer = await this.peer.createOffer();
|
const offer = await this.peer.createOffer();
|
||||||
await this.peer.setLocalDescription(offer);
|
await this.peer.setLocalDescription(offer);
|
||||||
return readyPromise;
|
return readyPromise;
|
|
@ -1,6 +1,5 @@
|
||||||
|
import { getDatabase, onValue, ref, set } from "firebase/database";
|
||||||
import "../firebase-config";
|
import "../firebase-config";
|
||||||
import { getDatabase, ref, onValue, set } from "firebase/database";
|
|
||||||
|
|
||||||
|
|
||||||
const db = getDatabase();
|
const db = getDatabase();
|
||||||
console.log(db);
|
console.log(db);
|
||||||
|
@ -11,16 +10,15 @@ let reff = ref(db, "/peers/demo");
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
var callback: (answer: any, candidates: any[]) => void;
|
||||||
|
|
||||||
var callback;
|
export function setCallback(call: typeof callback) {
|
||||||
export function setCallback(call) {
|
|
||||||
callback = call;
|
callback = call;
|
||||||
}
|
}
|
||||||
export function setOffer(offer: string) {
|
export function setOffer(offer: string) {
|
||||||
set(reff, offer);
|
set(reff, offer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onValue(reff, (snapshot) => {
|
onValue(reff, (snapshot) => {
|
||||||
const data = snapshot.val();
|
const data = snapshot.val();
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
@ -31,4 +29,3 @@ onValue(reff, (snapshot) => {
|
||||||
callback(answer, candidates);
|
callback(answer, candidates);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
4
client/src/index.ts
Normal file
4
client/src/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export { AdriftBareClient } from "./AdriftClient";
|
||||||
|
export { Connection } from "./Connection";
|
||||||
|
export { DevWsTransport } from "./DevWsTransport";
|
||||||
|
export { RTCTransport } from "./RTCTransport";
|
|
@ -16,7 +16,6 @@
|
||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"suppressImplicitAnyIndexErrors": true,
|
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
|
|
|
@ -20,7 +20,11 @@
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"vite": "^4.4.9",
|
"vite": "^4.4.9",
|
||||||
"vite-plugin-singlefile": "^0.13.5",
|
"vite-plugin-singlefile": "^0.13.5",
|
||||||
"vite-plugin-svelte": "^3.0.1"
|
"vite-plugin-svelte": "^3.0.1",
|
||||||
|
"bare-client-custom": "file:../bare-client-custom",
|
||||||
|
"firebase-config": "workspace:*",
|
||||||
|
"client": "workspace:*",
|
||||||
|
"protocol": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {}
|
"devDependencies": {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { AdriftBareClient } from "../client/AdriftClient";
|
|
||||||
import Connection from "../client/Connection";
|
|
||||||
import { DevWsTransport } from "../client/DevWsTransport";
|
|
||||||
import { RTCTransport } from "../client/RTCTransport";
|
|
||||||
// note: even though we import firebase, due to the tree shaking, it will only run if we use "auth" so if ADRIFT_DEV is set it won't import
|
|
||||||
import { auth } from "../firebase-config";
|
|
||||||
import type Transport from "../protocol/Transport";
|
|
||||||
import {
|
import {
|
||||||
BareClient,
|
AdriftBareClient,
|
||||||
|
Connection,
|
||||||
|
DevWsTransport,
|
||||||
|
RTCTransport,
|
||||||
|
} from "client";
|
||||||
|
// note: even though we import firebase, due to the tree shaking, it will only run if we use "auth" so if ADRIFT_DEV is set it won't import
|
||||||
|
import { auth } from "firebase-config";
|
||||||
|
import type { Transport } from "protocol";
|
||||||
|
import {
|
||||||
registerRemoteListener,
|
registerRemoteListener,
|
||||||
setBareClientImplementation,
|
setBareClientImplementation,
|
||||||
} from "bare-client-custom";
|
} from "bare-client-custom";
|
||||||
|
@ -16,14 +17,13 @@
|
||||||
|
|
||||||
let transport: Transport;
|
let transport: Transport;
|
||||||
|
|
||||||
let wstransport: DevWsTransport | undefined;
|
|
||||||
let rtctransport: RTCTransport | undefined;
|
let rtctransport: RTCTransport | undefined;
|
||||||
if (import.meta.env.VITE_ADRIFT_DEV) {
|
if (import.meta.env.VITE_ADRIFT_DEV) {
|
||||||
console.log(
|
console.log(
|
||||||
"%cADRIFT RUNNING IN DEVELOPMENT MODE",
|
"%cADRIFT RUNNING IN DEVELOPMENT MODE",
|
||||||
"background: blue; color: white; font-size: x-large"
|
"background: blue; color: white; font-size: x-large"
|
||||||
);
|
);
|
||||||
wstransport = transport = new DevWsTransport(
|
transport = new DevWsTransport(
|
||||||
() => console.log("onopen"),
|
() => console.log("onopen"),
|
||||||
() => console.log("onclose")
|
() => console.log("onclose")
|
||||||
);
|
);
|
||||||
|
@ -101,13 +101,12 @@
|
||||||
const { answer, candidates } = await r.json();
|
const { answer, candidates } = await r.json();
|
||||||
await rtctransport?.answer(answer, candidates);
|
await rtctransport?.answer(answer, candidates);
|
||||||
}
|
}
|
||||||
// connectDevHttp();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
{#if !import.meta.env.VITE_ADRIFT_DEV}
|
{#if !import.meta.env.VITE_ADRIFT_DEV}
|
||||||
<button on:click={connectFirebase}>Connect with firebase </button>
|
<button on:click={connectFirebase}>Connect with firebase </button>
|
||||||
{:else}
|
{:else}
|
||||||
connected to dev server
|
<button on:click={connectDevHttp}>Connect with dev HTTP</button>
|
||||||
{/if}
|
{/if}
|
||||||
</h1>
|
</h1>
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import App from "./App.svelte";
|
import App from "./App.svelte";
|
||||||
|
|
||||||
const app = new App({
|
const app = new App({
|
||||||
target: document.getElementById("app")
|
target: document.getElementById("app")!,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!import.meta.env.VITE_ADRIFT_SINGLEFILE) {
|
if (!import.meta.env.VITE_ADRIFT_SINGLEFILE) {
|
9
frontend/src/env.d.ts
vendored
Normal file
9
frontend/src/env.d.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
interface ImportMetaEnv {
|
||||||
|
readonly VITE_ADRIFT_DEV: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImportMeta {
|
||||||
|
readonly env: ImportMetaEnv;
|
||||||
|
}
|
|
@ -10,4 +10,4 @@ const config = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
|
33
frontend/tsconfig.json
Normal file
33
frontend/tsconfig.json
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"outDir": "build/dist",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "es2017",
|
||||||
|
"lib": ["es6", "dom", "esnext.asynciterable", "es2017"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"jsx": "react",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"rootDir": "..",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"removeComments": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"build",
|
||||||
|
"scripts",
|
||||||
|
"acceptance-tests",
|
||||||
|
"webpack",
|
||||||
|
"jest",
|
||||||
|
"src/setupTests.ts"
|
||||||
|
]
|
||||||
|
}
|
41
pnpm-lock.yaml
generated
41
pnpm-lock.yaml
generated
|
@ -8,6 +8,18 @@ importers:
|
||||||
|
|
||||||
.: {}
|
.: {}
|
||||||
|
|
||||||
|
client:
|
||||||
|
dependencies:
|
||||||
|
bare-client-custom:
|
||||||
|
specifier: file:../bare-client-custom
|
||||||
|
version: file:bare-client-custom
|
||||||
|
firebase:
|
||||||
|
specifier: ^10.1.0
|
||||||
|
version: 10.1.0(react-native@0.72.3)
|
||||||
|
protocol:
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../protocol
|
||||||
|
|
||||||
firebase-config:
|
firebase-config:
|
||||||
dependencies:
|
dependencies:
|
||||||
firebase:
|
firebase:
|
||||||
|
@ -19,9 +31,21 @@ importers:
|
||||||
'@sveltejs/vite-plugin-svelte':
|
'@sveltejs/vite-plugin-svelte':
|
||||||
specifier: ^2.4.5
|
specifier: ^2.4.5
|
||||||
version: 2.4.5(svelte@4.2.0)(vite@4.4.9)
|
version: 2.4.5(svelte@4.2.0)(vite@4.4.9)
|
||||||
|
bare-client-custom:
|
||||||
|
specifier: file:../bare-client-custom
|
||||||
|
version: file:bare-client-custom
|
||||||
|
client:
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../client
|
||||||
firebase:
|
firebase:
|
||||||
specifier: ^10.1.0
|
specifier: ^10.1.0
|
||||||
version: 10.1.0(react-native@0.72.3)
|
version: 10.1.0(react-native@0.72.3)
|
||||||
|
firebase-config:
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../firebase-config
|
||||||
|
protocol:
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../protocol
|
||||||
svelte:
|
svelte:
|
||||||
specifier: ^4.2.0
|
specifier: ^4.2.0
|
||||||
version: 4.2.0
|
version: 4.2.0
|
||||||
|
@ -2798,6 +2822,10 @@ packages:
|
||||||
resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
|
resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@types/uuid@9.0.2:
|
||||||
|
resolution: {integrity: sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/webrtc@0.0.36:
|
/@types/webrtc@0.0.36:
|
||||||
resolution: {integrity: sha512-tYFarc92EluXU7XyRmWbkQXSbZIOHTdDOudFPal9u/TNTQuouWpIHV/2o9bNAdqvTJFjLJh/zflCOLWbL30tEQ==}
|
resolution: {integrity: sha512-tYFarc92EluXU7XyRmWbkQXSbZIOHTdDOudFPal9u/TNTQuouWpIHV/2o9bNAdqvTJFjLJh/zflCOLWbL30tEQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -6407,6 +6435,11 @@ packages:
|
||||||
engines: {node: '>= 0.4.0'}
|
engines: {node: '>= 0.4.0'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/uuid@9.0.0:
|
||||||
|
resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==}
|
||||||
|
hasBin: true
|
||||||
|
dev: false
|
||||||
|
|
||||||
/v8-compile-cache-lib@3.0.1:
|
/v8-compile-cache-lib@3.0.1:
|
||||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
@ -6725,3 +6758,11 @@ packages:
|
||||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
file:bare-client-custom:
|
||||||
|
resolution: {directory: bare-client-custom, type: directory}
|
||||||
|
name: '@tomphttp/bare-client'
|
||||||
|
dependencies:
|
||||||
|
'@types/uuid': 9.0.2
|
||||||
|
uuid: 9.0.0
|
||||||
|
dev: false
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export default abstract class Transport {
|
export abstract class Transport {
|
||||||
public ondata: (data: ArrayBuffer) => void = () => {};
|
public ondata: (data: ArrayBuffer) => void = () => {};
|
||||||
constructor(public onopen: () => void, public onclose: () => void) {}
|
constructor(public onopen: () => void, public onclose: () => void) {}
|
||||||
|
|
||||||
|
|
|
@ -30,3 +30,5 @@ export type HTTPResponsePayload = {
|
||||||
statusText: string;
|
statusText: string;
|
||||||
headers: ProtoBareHeaders;
|
headers: ProtoBareHeaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export { Transport } from "./Transport";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue