- Modify app.js to use the address of your websocket server instead of
ws://ws-server:8088
. - Run the websocket server:
node ws-server.js
- Run an HTTP static file server of your choice:
python3 -m http.server 8080
- Visit index.html or your HTTP static file server root. Do this on 2 different computers or 2 tabs on the same computer.
- The screen is blank. Open the Javascript console and set values for
me
andother
. Do the same on the other computer/tab (but inverting the values this time). Then callconnect
. After the connection is established you'll be able to callchannel.send('message')
and see the event logs at the other computer/tab.
me = 'bob'
other = 'ana'
me = 'ana'
other = 'bob'
connect()
channel.send('hello, ana!')