@nifrajs/workers 1.12.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.ts +4 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nifrajs/workers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Cloudflare Workers helpers for nifra — a Durable Object hub for cross-connection WebSocket broadcast.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@nifrajs/core": "
|
|
32
|
+
"@nifrajs/core": "2.0.0"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
package/src/index.ts
CHANGED
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
* with their normal nifra semantics. Route upgrades to it with `toFetchHandler(app, { webSocketHub })`.
|
|
9
9
|
*
|
|
10
10
|
* // worker.ts
|
|
11
|
-
* import { server } from "@nifrajs/core"
|
|
12
|
-
* import { toFetchHandler } from "@nifrajs/core"
|
|
11
|
+
* import { server, toFetchHandler } from "@nifrajs/core/server"
|
|
13
12
|
* import { createWebSocketHub } from "@nifrajs/workers"
|
|
14
13
|
*
|
|
15
14
|
* const app = server().ws("/chat", {
|
|
@@ -28,10 +27,10 @@
|
|
|
28
27
|
* # tag = "v1"
|
|
29
28
|
* # new_sqlite_classes = ["NifraWebSocketHub"]
|
|
30
29
|
*/
|
|
31
|
-
//
|
|
32
|
-
//
|
|
30
|
+
// This adapter imports `attachWebSocket` to wire the Workers `WebSocketPair`. The user's backend
|
|
31
|
+
// enables `app.ws()` on its own server with `.use(websocket())` from `@nifrajs/core/ws`.
|
|
33
32
|
|
|
34
|
-
import type { StandardWebSocket, WebSocketUpgradeOutcome } from "@nifrajs/core"
|
|
33
|
+
import type { StandardWebSocket, WebSocketUpgradeOutcome } from "@nifrajs/core/server"
|
|
35
34
|
import { attachWebSocket } from "@nifrajs/core/ws"
|
|
36
35
|
|
|
37
36
|
/** The nifra-app surface the hub needs — every `server()` app satisfies it. */
|