Steve Perkins
f1eb9a3bc7
Reuse connectionPromise for relay connect.
2023-04-04 08:10:51 -03:00
fiatjaf
5733f9c4e4
reject promise on WebSocket initiation failure.
2023-03-19 09:07:16 -03:00
BilligsterUser
6b73bbf8a3
Type sub event handler ( #156 )
...
* RelayEvent allow Promises
* type Sub EventHandler
* Update relay.ts
2023-03-12 08:51:38 -03:00
BilligsterUser
d244b62c7a
type Relay EventHandler ( #121 )
...
* type Relay EventHandler
* Update relay.ts
2023-03-11 15:24:52 -03:00
ramigs
82228036ef
close relay's websocket only if it's in state OPEN
2023-03-04 12:57:50 -03:00
fiatjaf
9d345a8f01
configurable list and get timeout on relay.
2023-02-26 21:23:09 -03:00
fiatjaf
a8938a3a0f
wait a second before failing to send on a not yet connected websocket.
2023-02-26 16:53:03 -03:00
Fernando López Guevara
f43d23d344
fix(relay): prevent accesing to ws if it is undefined
2023-02-23 15:20:10 -03:00
fiatjaf
3d93ec8446
remove resolveClose, close() is now fire-and-forget.
2023-02-17 14:51:56 -03:00
fiatjaf
24406b5679
more automatic cleanup of event listeners.
2023-02-15 20:36:22 -03:00
fiatjaf
6dbcc87d93
delete listeners when closing a relay connection.
2023-02-15 20:31:25 -03:00
fiatjaf
0ddcfdce68
remove "seen" event from Pub.
...
too complicated. if anyone wants this they can do it themselves.
2023-02-15 20:21:29 -03:00
fiatjaf
32793146a4
remove untilOpen promise that was causing memory leaks when a connection was never opened.
2023-02-14 11:24:30 -03:00
fiatjaf
9bcaed6e60
fix tests, .seenOn() method for pools.
2023-02-09 22:01:01 -03:00
fiatjaf
ff3bf4a51c
improvements and fixes on pool.
2023-02-09 12:05:31 -03:00
fiatjaf
7ff97b5488
list() and get() methods.
2023-02-08 16:37:53 -03:00
fiatjaf
75d7be5a54
use per-subscription alreadyHaveEvent handler instead of per-relay.
...
now pools are much smarter.
2023-02-08 14:15:54 -03:00
fiatjaf
4485c8ed5e
remove broken globalThis error type.
2023-02-08 14:15:54 -03:00
fiatjaf
da59e3ce90
when in pool, automatically and efficiently deduplicate.
2023-02-08 09:46:05 -03:00
gaodeng
9082953ede
fix error event
2023-02-07 06:03:41 -03:00
fiatjaf
26089ef958
refactor previous commit a little, add fakejson module for simple parsing that doesn't use regex.
2023-01-22 10:32:33 -03:00
Martti Malmi
2e305b7cd4
incoming message queue, alreadyHaveEvent check, msg.send catch
2023-01-21 07:03:12 -03:00
Tristan
8071e2f4fa
Make opts arg optional for sub method
...
In the README and the code, it looks like the second argument for the relay's `sub` method is optional:
```typescript
let sub = relay.sub([
{
ids: ['d7dd5eb3ab747e16f8d0212d53032ea2a7cadef53837e5a6c66d42849fcb9027']
}
])
```
In the type definitions it's required however, which leads to an error in editors. Let's mark it as optional in the type definitions too! 👍
2022-12-25 14:32:20 -03:00
Tristan
cc2250da1f
Add missing "error" event to on and off type definitions
2022-12-25 14:31:38 -03:00
rkfg
c37d10bb9d
Fix resolveClose
2022-12-24 20:41:49 -03:00
rkfg
97e28fdf9a
Fix connect/close return types and race condition
2022-12-24 18:49:16 -03:00
fiatjaf
74a0d5454a
guard against some nonexisting arrays of event listeners.
2022-12-23 15:18:23 -03:00
fiatjaf
ac698ef67d
make relay.connect() an awaitable thing.
2022-12-22 08:53:40 -03:00
fiatjaf
8aa31bb437
remove websocket-polyfill, instruct nodejs users to install it manually.
2022-12-21 16:23:47 -03:00
fiatjaf
0500415a4e
remove all the auto-reconnection code from relay.
2022-12-21 15:31:57 -03:00
Martti Malmi
a78e2036aa
status code 3 (closed) for un-opened connection
2022-12-21 11:15:36 +02:00
Martti Malmi
adc1854ac6
relay.status() returns 0 when ws not created
2022-12-21 11:08:10 +02:00
fiatjaf
53b0091bf4
some fixes on relay.ts and tests.
2022-12-20 15:25:34 -03:00
fiatjaf
de8bdd8370
fix typescript types everywhere, delete pool.js and refactor relay.js to use event listeners everywhere.
2022-12-18 17:02:19 -03:00