@gwakko/shared-websocket 0.1.0 → 0.1.1
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/README.md +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Tab 1 (Leader) Tab 2 (Follower) Tab 3 (Follower)
|
|
|
25
25
|
### From npm
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install shared-websocket
|
|
28
|
+
npm install @gwakko/shared-websocket
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
### From GitHub (latest source)
|
|
@@ -54,7 +54,7 @@ npm run build # outputs ESM + CJS + types to dist/
|
|
|
54
54
|
## Usage — Vanilla TypeScript
|
|
55
55
|
|
|
56
56
|
```typescript
|
|
57
|
-
import { SharedWebSocket } from 'shared-websocket';
|
|
57
|
+
import { SharedWebSocket } from '@gwakko/shared-websocket';
|
|
58
58
|
|
|
59
59
|
const ws = new SharedWebSocket('wss://api.example.com/ws', {
|
|
60
60
|
auth: () => localStorage.getItem('token')!,
|
|
@@ -89,7 +89,7 @@ ws.disconnect();
|
|
|
89
89
|
Auto-creates, connects, and disposes. Guarantees cleanup even on errors.
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
|
-
import { withSocket } from 'shared-websocket';
|
|
92
|
+
import { withSocket } from '@gwakko/shared-websocket';
|
|
93
93
|
|
|
94
94
|
// Basic
|
|
95
95
|
await withSocket('wss://api.example.com/ws', async ({ ws }) => {
|
|
@@ -166,7 +166,7 @@ import {
|
|
|
166
166
|
useSocketStream,
|
|
167
167
|
useSocketSync,
|
|
168
168
|
useSocketStatus,
|
|
169
|
-
} from 'shared-websocket/
|
|
169
|
+
} from '@gwakko/shared-websocket/react';
|
|
170
170
|
|
|
171
171
|
// Provider accepts url and options as props
|
|
172
172
|
function App() {
|
|
@@ -217,7 +217,7 @@ function Dashboard() {
|
|
|
217
217
|
<!-- main.ts -->
|
|
218
218
|
<script setup>
|
|
219
219
|
import { createApp } from 'vue';
|
|
220
|
-
import { createSharedWebSocketPlugin } from 'shared-websocket/
|
|
220
|
+
import { createSharedWebSocketPlugin } from '@gwakko/shared-websocket/vue';
|
|
221
221
|
import App from './App.vue';
|
|
222
222
|
|
|
223
223
|
const app = createApp(App);
|
|
@@ -235,7 +235,7 @@ import {
|
|
|
235
235
|
useSocketStream,
|
|
236
236
|
useSocketSync,
|
|
237
237
|
useSocketStatus,
|
|
238
|
-
} from 'shared-websocket/
|
|
238
|
+
} from '@gwakko/shared-websocket/vue';
|
|
239
239
|
|
|
240
240
|
const ws = useSharedWebSocket();
|
|
241
241
|
|
package/package.json
CHANGED