Ask coding questions

← Back to all posts
Trying to use a get request to a website with wss://
h
Mathman05

I'm trying to do a get request to wss://site.com using request to do the get request. I know the other side is using jetty to handle the receiving of the request. how would I in node.js do a get request that they would like, I have the proper everything else so it should work other than the wss:// needing to be added. I'm currently using the library request for the get requests. Does anyone have any idea how to fix this issue?

Voters
AndrewJefferso1
Mathman05
Comments
hotnewtop
tussiez

wss:// is not supported on Repl.it. The socket.io package works:

Coder100

i don't think he owns the server @tussiez

tussiez

@Coder100 Repl.it?

Coder100

wss:// means websocktes, which isn't http, which means requests doesn't and shouldn't be able to get the URL successfully. You need to use a websocket library to do this.

Use this: https://www.npmjs.com/package/websocket

Mathman05

@Coder100 thanks for the responce, I'm having issues with this for a get request would I do var client = new W3CWebSocket('wss://website.com/'+number,'echo-protocol'); to start? or is this incorrect? as this is giving me an error I'm unsure if the website is wrong or my get is wrong

Coder100

send repl @Mathman05

Mathman05
Coder100

ok the error was that the connection was denied for some reason @Mathman05

Mathman05

@Coder100 I know it's the correct URL, and the other information is done correctly or it would have given me an error earlier, is there a way to get the error message?

Mathman05

@Coder100 wait a min I need to create a WebSocket connection, sorry it's not a get, how would I do that?

Coder100

create a new websocket client @Mathman05

Coder100

remember this is not http, you can't just connect and expect to get any results. @Mathman05