Forum > Coding >

[Help] How to Make a WebSocket Thingy for a Repl (WebSocketSharp)

TERIHAX

i say im gay as a joke 🙀

Posts: 1791

Threads: 92

Joined: Jul, 2020

Reputation: 30

Posted

so yeah the title is confusing but i didn't know how to say it

 

this thread is partly C# and partly js, but its mainly focused on C# tho

const port = 6969; // 6969;
const serverlistenthingy = http.createServer().listen(port);
const websocket = new web({ httpServer: serverlistenthingy });

websocket.on("request", (request) => {
    console.log("a person joined");
});

ok so ^ is my reply code, so if someone connects to the websocket, it would print "a person joined" to the console but it isn't

 

I've tried this on my localhost and it works

 

when i use localhost (in my C# app)

WebSocket ws = new WebSocket("ws://localhost:6969");
ws.Connect(); // when i run it shows "a person joined" in the js console

when i use this it works, it prints "a person joined" in the js console

 

but I've tried on my repl, and it doesn't work:

WebSocket ws = new WebSocket("ws://myrepl.repluser.repl.co:6969");
ws.Connect(); // when i run this in the C# app nothing shows in js console

ignore the "myrepl.repluser" thingy i just don't wanna let ppl know my repl bc no

 

OK IM RETARDED I FOUND OUT THE REASON

 

its supposed to be starting with wss:// instead of ws://

WebSocket ws = new WebSocket("wss://myrepl.repluser.repl.co:6969");
ws.Connect(); // this works now
  • 0

Posts: 1659

Threads: 10

Joined: Sep, 2020

Reputation: 59

Replied

Jesus christ

  • 0

Discord : Doctor Doom#0550

Posts: 674

Threads: 30

Joined: Aug, 2020

Reputation: 6

Replied

https / wss bro 

  • 0

TERIHAX

i say im gay as a joke 🙀

Posts: 1791

Threads: 92

Joined: Jul, 2020

Reputation: 30

Replied

@MaximusExploit i put it on https and http and everything i could think of and it still didn't work, wss was the only one that worked

  • 0

Posts: 674

Threads: 30

Joined: Aug, 2020

Reputation: 6

Replied

@TERIHAX u stupid 

 

http = ws

https = wss

  • 0

TERIHAX

i say im gay as a joke 🙀

Posts: 1791

Threads: 92

Joined: Jul, 2020

Reputation: 30

Replied

@MaximusExploit wat dafuq, https and http didnt even work, only wss did that makes no sense

  • 0

Posts: 674

Threads: 30

Joined: Aug, 2020

Reputation: 6

Replied

@TERIHAX you f*cking d*mbass

  • 0

TERIHAX

i say im gay as a joke 🙀

Posts: 1791

Threads: 92

Joined: Jul, 2020

Reputation: 30

Replied

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )