Skip to content

Commit 4089e66

Browse files
MrSerthDome-GER
authored andcommitted
Unify comparison of the WebSocket ready state
Previously, we used some mixed methods to identify the ready state of WebSocket connections with different methods and target states. By using the same method and enum values, we can ensure easier navigation for developers and better maintenance.
1 parent 65e88ac commit 4089e66

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/assets/javascripts/editor/websocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CommandSocket.prototype.executeCommand = function(cmd) {
9494
CommandSocket.prototype.send = function(data) {
9595
// Only send message if WebSocket is open and ready.
9696
// Ignore all other messages (they might hit a wrong container anyway)
97-
if (this.getReadyState() === this.websocket.OPEN) {
97+
if (this.getReadyState() === WebSocket.OPEN) {
9898
this.websocket.send(data);
9999
}
100100
};

spec/support/wait_for_websocket.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def wait_for_websocket
88
end
99

1010
def websocket_finished?
11-
page.evaluate_script('CodeOceanEditorWebsocket?.websocket?.websocket?.readyState == WebSocket.CLOSED').present?
11+
page.evaluate_script('CodeOceanEditorWebsocket?.websocket?.getReadyState() === WebSocket.CLOSED').present?
1212
end
1313
end
1414

0 commit comments

Comments
 (0)