#websocket

1 messages · Page 1 of 1 (latest)

next plaza
#

Looks like it's displaying the bytes/hex ascii representation. I don't know about javascript but can you convert it to a string?

cosmic hazel
#

I believe so, but in the video that I watched the websocket in javascript, it didn't convert to a String, I tried to do that too, I used the toString() command in the message, but it continued with the same error

#

for me to send a message in my websocket I created an html and inside the console I put ws.send("hello")

next plaza
#

I'm not sure if I'll be able to help personally but it'd make it more likely that somebody else can if you share your code and maybe a link to that tutorial

cosmic hazel
#

no problem, do you know anyone on this server who has more focus on javascript?

next plaza
#

There are a lot of people. This time of day is just a bit quiet since most of EU are at work/school and US are just starting their day

cosmic hazel
#

understand

next plaza
#

If you share your code I'm sure somebody will get to you as soon as they can 😊

cosmic hazel
#

const ws = require("ws")
const express = require("express")
const expressServer = express()
const wsServer = new ws.Server({
server: expressServer.listen(3000),
host: "localhost",
path: "/"
})
wsServer.on("connection", (w) => {
console.log("someone connected")
w.on("message", (msg) => {
console.log("got message: ", msg)
w.send(msg)
})
})
expressServer.listen(() => console.log("listening..."))