@@ -211,7 +211,7 @@ class ThingURLDevice extends Device {
211211 } else if ( link . href . startsWith ( 'ws://' ) ||
212212 link . href . startsWith ( 'wss://' ) ) {
213213 this . wsUrl = link . href ;
214- this . createWebsocket ( ) ;
214+ this . createWebSocket ( ) ;
215215 } else {
216216 this . links . push ( link ) ;
217217 }
@@ -231,20 +231,20 @@ class ThingURLDevice extends Device {
231231 }
232232 }
233233
234- closeWebsocket ( ) {
234+ closeWebSocket ( ) {
235235 this . closing = true ;
236236 if ( this . ws !== null ) {
237237 if ( this . ws . readyState === WebSocket . OPEN ) {
238238 this . ws . close ( ) ;
239239 }
240240
241- // Allow the cleanup code in createWebsocket to handle shutdown
241+ // Allow the cleanup code in createWebSocket to handle shutdown
242242 } else if ( this . scheduledUpdate ) {
243243 clearTimeout ( this . scheduledUpdate ) ;
244244 }
245245 }
246246
247- createWebsocket ( ) {
247+ createWebSocket ( ) {
248248 if ( this . closing ) {
249249 return ;
250250 }
@@ -330,7 +330,7 @@ class ThingURLDevice extends Device {
330330
331331 setTimeout ( ( ) => {
332332 this . wsBackoff = Math . min ( this . wsBackoff * 2 , WS_MAX_BACKOFF ) ;
333- this . createWebsocket ( ) ;
333+ this . createWebSocket ( ) ;
334334 } , this . wsBackoff ) ;
335335 } ;
336336
@@ -580,7 +580,7 @@ class ThingURLAdapter extends Adapter {
580580 for ( const id in this . devices ) {
581581 const device = this . devices [ id ] ;
582582 if ( device . mdnsUrl === url ) {
583- device . closeWebsocket ( ) ;
583+ device . closeWebSocket ( ) ;
584584 this . removeThing ( device ) ;
585585 }
586586 }
@@ -621,6 +621,7 @@ class ThingURLAdapter extends Adapter {
621621 return this . removeDeviceFromConfig ( device ) . then ( ( ) => {
622622 if ( this . devices . hasOwnProperty ( device . id ) ) {
623623 this . handleDeviceRemoved ( device ) ;
624+ device . closeWebSocket ( ) ;
624625 return device ;
625626 } else {
626627 throw new Error ( `Device: ${ device . id } not found.` ) ;
@@ -678,7 +679,7 @@ class ThingURLAdapter extends Adapter {
678679 }
679680
680681 for ( const id in this . devices ) {
681- this . devices [ id ] . closeWebsocket ( ) ;
682+ this . devices [ id ] . closeWebSocket ( ) ;
682683 }
683684
684685 return super . unload ( ) ;
0 commit comments