Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ LiveServer.start = function(options) {
// WebSocket
var clients = [];
server.addListener('upgrade', function(request, socket, head) {

// Ignore requests that are not from `/live-server-socket` URLs
if (!/\/live-server-socket$/.test(request.url)) return;

var ws = new WebSocket(request, socket, head);
ws.onopen = function() { ws.send('connected'); };

Expand Down
2 changes: 1 addition & 1 deletion injected.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
}
var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
var address = protocol + window.location.host + window.location.pathname + '/ws';
var address = protocol + window.location.host + window.location.pathname + '/live-server-socket';
var socket = new WebSocket(address);
socket.onmessage = function(msg) {
if (msg.data == 'reload') window.location.reload();
Expand Down