Skip to content

Commit 8cf24e0

Browse files
committed
fix: use more consistent naming for defineWSHandler
1 parent ff35d39 commit 8cf24e0

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A Nuxt module aimed to simplify real-time communication with built-in automatic
1414
## Features
1515

1616
- `useWS` ([demo](https://reactive-ws.s94.dev/)): A WebSocket implementation with built-in shared state management, topic subscriptions, and type safety.
17-
- `defineReactiveWSHandler`: wraps Nitro's `defineWebSocketHandler` to provide additional configuration, hooks and automatic topic subscription.
17+
- `defineWSHandler`: wraps Nitro's `defineWebSocketHandler` to provide additional configuration, hooks and automatic topic subscription.
1818

1919
## Quick Setup
2020

@@ -104,7 +104,7 @@ Server-Side (`server/routes/_ws.ts`):
104104
```ts
105105
import * as v from 'valibot'
106106

107-
export default defineReactiveWSHandler({
107+
export default defineWSHandler({
108108
async open(peer) {
109109
// Update peer with 'chat' data from storage
110110
const chat = await useStorage('ws').getItem('chat')

playground/server/routes/_ws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as v from 'valibot'
22

3-
export default defineReactiveWSHandler({
3+
export default defineWSHandler({
44
async open(peer) {
55
// Update peer with data from storage
66
peer.topics.forEach(async (topic) => {

src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default defineNuxtModule<ModuleOptions>({
6868
from: resolve('./runtime/server/utils/ws'),
6969
},
7070
{
71-
name: 'defineReactiveWSHandler',
71+
name: 'defineWSHandler',
7272
from: resolve('./runtime/server/utils/ws'),
7373
},
7474
])

src/runtime/server/utils/ws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface _WSRuntimeConfig {
2020
*
2121
* @see — https://h3.unjs.io/guide/websocket
2222
*/
23-
export function defineReactiveWSHandler(hooks: Partial<WSHandlerHooks>) {
23+
export function defineWSHandler(hooks: Partial<WSHandlerHooks>) {
2424
let nitroApp: NitroApp
2525
let config: _WSRuntimeConfig
2626

0 commit comments

Comments
 (0)