Skip to content

Commit

Permalink
receive ws in onMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
charleston10 committed Dec 4, 2023
1 parent 4881bcb commit 6687712
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sample/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Mockenzo().http()
console.log("http server is running")
});

const socketMockenzo = Mockenzo()
Mockenzo()
.socket()
.on(3001)
.onConnection(() => {
console.log('received new connection')
})
.onMessage((data) => {
console.log(data)//print message sent to server
socketMockenzo.send("successful")//clients receive "successful"
.onMessage((ws, data) => {
console.log('on message', data)
ws.emit('message', 'message received of client');
})
.onError((error) => {
console.error('received error', error)
Expand Down

0 comments on commit 6687712

Please sign in to comment.