File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ export class EveClient {
214
214
// ping the server so that the connection isn't overzealously
215
215
// closed
216
216
setInterval ( ( ) => {
217
- this . socketSend ( "\"PING\"" ) ;
217
+ this . socketSend ( JSON . stringify ( { type : "ping" } ) ) ;
218
218
} , 30000 ) ;
219
219
}
220
220
Original file line number Diff line number Diff line change @@ -97,7 +97,14 @@ export abstract class RuntimeClient {
97
97
98
98
handleEvent ( json :string ) {
99
99
let data = JSON . parse ( json ) ;
100
- if ( typeof data !== "object" ) throw new Error ( data ) ;
100
+
101
+ // Events are expected to be objects that have a type property
102
+ // if they aren't, we toss the event out
103
+ if ( typeof data !== "object" || data . type === undefined ) {
104
+ console . error ( "Got invalid JSON event: " + json ) ;
105
+ return ;
106
+ }
107
+
101
108
if ( data . type === "event" ) {
102
109
if ( ! this . evaluation ) return ;
103
110
// console.info("EVENT", json);
You can’t perform that action at this time.
0 commit comments