Skip to content

Reliable Websocket#1

Merged
syaau merged 10 commits intoBhoos:masterfrom
bpanthi977:master
Aug 31, 2022
Merged

Reliable Websocket#1
syaau merged 10 commits intoBhoos:masterfrom
bpanthi977:master

Conversation

@bpanthi977
Copy link
Copy Markdown
Contributor

IMPORTANT: Please do not create a Pull Request without creating an issue first. 
Any change needs to be discussed and documented before proceeding.
Mention which issue(s) are closed by this PR below. 
For e.g "Fixes #123 Fixes #12" in case of multiple fixes or include the issues under "Linked Issues"

Fixes #

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if necessary)
  • I have performed adequate tests that prove my fix is effective or that my feature works

Proposed Changes

A reliable dropin replacement for websocket.

  • Pings at a certain interval
  • Retries lost connection
  • Buffers messages during lost connection

Comment thread package.json Outdated
@@ -0,0 +1,22 @@
{
"name": "reliable-websocket",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have this named @bhoos/websocket

Comment thread package.json Outdated
"name": "reliable-websocket",
"version": "0.0.0",
"description": "reliable websocket client",
"main": "dist/index.js",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to go for es6 modules, so our typescript config should default to es6, and may be create a separate build for cjs.

{
  "main": "dist/index.js",
  "module": "es6/index.js",
  "type": "module",
  "react-native": "src/index.js"
}

Comment thread package.json Outdated
},
"dependencies": {
"ring-buffer-ts": "^1.0.3",
"ws": "^8.8.1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will not depend on "ws" as it is not required on clients.

Comment thread src/node.d.ts Outdated
Comment on lines +1 to +10
import { CloseEvent, Event, ErrorEvent, MessageEvent } from 'ws';
import { ReliableWS as WS } from './index.js';

export declare class ReliableWS extends WS {
onopen: ((event: Event) => void) | null;
onerror: ((event: ErrorEvent) => void) | null;
onclose: ((event: CloseEvent) => void) | null;
onmessage: ((event: MessageEvent) => void) | null;

}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpanthi977 Aren't we able to get rid of this file now ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we are.
Oversight from my part.

Comment thread src/node.ts
@syaau syaau merged commit a90534b into Bhoos:master Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants