I have been trying to setup a server where users can send sign in using websockets, but I don't want to do this using ws. I want to be able turn on wss without having https. Sadly, there aren't any options to do this. And so the question is how would one do this on the client side without using https protocol.
Is it possible to force socket.io to use wss instead of ws, without having to change to https?
29k Views Asked by Kitanga Nday At
2
There are 2 best solutions below
2
Brilliand
On
Yes, this is possible. To do this, pass your websocket URL to the socket.io client directly, like this:
var socket = io('wss://example.com/');
Note that the reverse is not possible: while there's nothing to prevent HTTP pages from creating WSS connections, most browsers today block any WS connection from an HTTPS page to enforce the heightened security.
I would also caution that a websocket opened over WSS is still no more secure than the page it originated from. If you're using WSS for its security benefits, be advised that all that security could be for naught if an attacker overrides your page at the time that it's loaded (which HTTPS would prevent).
Related Questions in JAVASCRIPT
- Angular Show All When No Filter Is Supplied
- Why does a function show up as not defined
- I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
- Set "More" "Less" font size
- Using pagination on a table in AngularJS
- How to sort these using Javascript or Jquery Most effectively
- how to fill out the table with next values in array with one button
- State with different subviews
- Ajax jQuery firing multiple time display event for the same result
- Getting and passing MVC Model data to AngularJS controller
- Disable variable in eval
- javascript nested loops waiting for user input
- .hover() seems to overwrite .click()
- How to sort a multi-dimensional array by the second array in descending order?
- How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?
Related Questions in SOCKETS
- Drawing with ncurses, sockets and fork
- UDP sockets in C not working
- How can I send multiple objects over one socket in java?
- psuedo TCP multicast with os.dup2() in python?
- My get request for http is very slow
- Nodejs connect mysql socket to another host?
- HttpRequestContext vs HttpContext
- Spring based client server communication without network
- Java does not accept 2 methods with same name
- Retrieve Data From EOC(Eithernet Over coxial) device
- Ping a server without freezing the Thread
- C sockets: Exit client after all data is received
- What is the best way to send XML converted to a byte array over TCP, then translate the response back to readable XML?
- C# Winform to Connect to Device Using IP
- Java Restart a Socket
Related Questions in SECURITY
- Can MVC.NET prevent SQL-injection at razor or controller level?
- Forgotten password reset page: should the user need to enter a username/email as well?
- Dynamic roles list in CustomAuthorize ASP MVC
- Access roles from multiple applications
- How to Fix TLS CBC Incorrect Padding Abuse Vulnerability on Windows 2003 Server
- Evernote Web Clipper and Content Security Policy
- Invalidate user credentials when password changes
- Spring Boot MVC non-role based security
- Correct Captcha behaviour on error
- Is macro more secure than static const if I don't want someone to know or change the hardcode value?
- In Android, ensuring only pre-decided users can only use the app
- Authenticating plain text passwords against md5 hash in DB using Apache Shiro
- Symfony2 - handle HTTP/Entity user access restrictions
- Client side computation without exposing code?
- searchable row level encryption using java?
Related Questions in SOCKET.IO
- How to send raw data using socket.io
- Stop receiving an event for some time in socket io
- Socket.io chat application not working with express?
- Deleting namespace in Socket IO
- Connecting a web client to a c++ server with TCP
- Node.js - Socket.io io.emit() doing nothing
- Angular.js - How to make limitTo dynamic and persistant inside a nested ng-repeat with real time socket.io data updates
- Socketing for a Real-Time Django Application
- Get Socket Object by Id with node, redis-adapter and socket.io
- Node.js Socket.io seperate connection events for each page
- nodejs , socket.io simple code memory leak
- Is it possible to force Socket.io to use its Ajax fallback?
- Forward all messages to socket.io room
- Using Node.JS With ASP.NET WebForm and Socket.IO
- socket.io xhr post error on slow connection (3G mobile network)
Related Questions in WSS
- Outgoing WSS authorization from WebRequest C#
- wss fails over https on apache server
- Get Data from WebSocket using .Net ClientWebSocket
- Sites within a SharePoint 2013 HNSC web application not working on one server
- Is it possible to force socket.io to use wss instead of ws, without having to change to https?
- Java WebSocketClient set cookie header
- WebSockets TLS ERR_CONNECTION_RESET
- If I have already a HTTPS can I use wss, or I need to pay additional fee?
- How to use WS-Security [WSS] SOAP in Swift
- Websockets not working on WSS over https but works fine with ws over http
- SharePoint - Running concurrent custom timer jobs
- Installing WebApplication scoped feature through code - SharePoint
- Sharepoint (WSS) templates and missing customisations
- Adding HTTPHandler using SPWebConfigModification
- Accessing SharePoint content (list) from a WCF service
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
From the Websocket protocol specification:
Emphasis mine
Now you can understand the absurdity of your request: wss is https.
Of course the terminology is wrong (https is a different protocol than wss) but the bottom of the line is that both are simply the version of their respective TCP plain protocols (http and ws) over TLS.
So the answer is no.
As a matter of fact security is a complex thing.
Very experienced programmers refrain from inventing or exploring new ways and, based on the kind of question you asked, you don't appear to have much expertise this field.
So it's better to do things as best-practices say, it they say to use "https" use "https".
Starting studying security seriously (or hiring a contractor) is advised, inventing new ways to perform secure authentication is not, unless you have a PhD in abstract algebra and several years of experience in developing cryptographic schemes.