File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 152152 reconnect ( ) {
153153 let oldSocket = this . socket ;
154154 const { url, subscribers, property } = this ;
155-
155+
156+ // Map subscribers to an all uppercase object since MCWS is
157+ // not consistent.
158+ let upperCaseSubscribers = Object . fromEntries (
159+ Object . entries ( subscribers ) . map ( ( [ key , value ] ) => [
160+ key === "undefined" ? key : key . toUpperCase ( ) ,
161+ value
162+ ] )
163+ ) ;
164+
156165 // no subscribers or no topic close existing socket
157166 // suppress errors as they are not useful
158167 if ( Object . keys ( subscribers ) . length < 1 || ! this . topic ) {
194203 const data = JSON . parse ( message . data ) ;
195204
196205 data . forEach ( ( datum ) => {
197- const key = datum [ property ] . toUpperCase ( ) ;
198- if ( subscribers [ key ] > 0 ) {
206+ const key = datum [ property ] ? .toUpperCase ( ) ;
207+ if ( upperCaseSubscribers [ key ] > 0 ) {
199208 self . postMessage ( {
200209 url : url ,
201210 key : key ,
You can’t perform that action at this time.
0 commit comments