Skip to content

Commit a15d239

Browse files
committed
♻️ refactor: remove logs & cleanup
1 parent 2dec6e3 commit a15d239

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/use/crossws.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export function makeHooks<
8585

8686
return defineHooks<Partial<Hooks>>({
8787
open(peer) {
88-
console.log('opening');
8988
const client: Client = {
9089
handleIncomingMessage: () => {
9190
throw new Error('Message received before handler was registered');
@@ -102,24 +101,18 @@ export function makeHooks<
102101
) || '',
103102

104103
send: async (message) => {
105-
console.log(clients);
106-
107104
// ws might have been destroyed in the meantime, send only if exists
108105
if (clients.has(peer)) {
109-
console.log('has client');
110-
111106
peer.send(message);
112-
} else {
113-
console.log('doesnt have client');
114107
}
115108
},
116109
close: (code, reason) => {
117110
if (clients.has(peer)) {
118111
peer.close(code, reason);
119112
}
120113
},
121-
onMessage: (handleIncoming) => {
122-
client.handleIncomingMessage = handleIncoming;
114+
onMessage: (cb) => {
115+
client.handleIncomingMessage = cb;
123116
},
124117
},
125118
{ socket: peer.websocket } as Extra & Partial<E>,
@@ -128,8 +121,6 @@ export function makeHooks<
128121
clients.set(peer, client);
129122
},
130123
async message(peer, message) {
131-
console.log('got message');
132-
133124
const client = clients.get(peer);
134125
if (!client) throw new Error('Message received for a missing client');
135126

0 commit comments

Comments
 (0)