diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html
index b3b91aca..86665571 100644
--- a/kfet/templates/kfet/kpsul.html
+++ b/kfet/templates/kfet/kpsul.html
@@ -1065,7 +1065,8 @@ $(document).ready(function() {
websocket_msg_default = {'opegroups':[],'opes':[],'checkouts':[],'articles':[]}
- socket = new ReconnectingWebSocket("ws://" + window.location.host + "/ws/k-fet/k-psul/");
+ var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws';
+ socket = new ReconnectingWebSocket(websocket_protocol+"://" + window.location.host + "/ws/k-fet/k-psul/");
socket.onmessage = function(e) {
data = $.extend({}, websocket_msg_default, JSON.parse(e.data));