File tree Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,14 @@ export abstract class Channel {
3232 abstract stopListening ( event : string ) : Channel ;
3333
3434 /**
35- * Stop listening for a whispser event on the channel instance.
35+ * Stop listening for a whisper event on the channel instance.
3636 */
3737 stopListeningForWhisper ( event : string ) : Channel {
3838 return this . stopListening ( '.client-' + event ) ;
3939 }
40+
41+ /**
42+ * Register a callback to be called anytime an error occurs.
43+ */
44+ abstract error ( callback : Function ) : Channel ;
4045}
Original file line number Diff line number Diff line change @@ -32,6 +32,13 @@ export class NullChannel extends Channel {
3232 return this ;
3333 }
3434
35+ /**
36+ * Register a callback to be called anytime an error occurs.
37+ */
38+ error ( callback : Function ) : NullChannel {
39+ return this ;
40+ }
41+
3542 /**
3643 * Bind a channel to an event.
3744 */
Original file line number Diff line number Diff line change 1- import { EventFormatter } from './. ./util' ;
1+ import { EventFormatter } from '../util' ;
22import { Channel } from './channel' ;
33
44/**
@@ -76,6 +76,17 @@ export class PusherChannel extends Channel {
7676 return this ;
7777 }
7878
79+ /**
80+ * Register a callback to be called anytime a subscription error occurs.
81+ */
82+ error ( callback : Function ) : PusherChannel {
83+ this . on ( 'pusher:subscription_error' , ( status ) => {
84+ callback ( status ) ;
85+ } ) ;
86+
87+ return this ;
88+ }
89+
7990 /**
8091 * Bind a channel to an event.
8192 */
Original file line number Diff line number Diff line change 1- import { EventFormatter } from './. ./util' ;
1+ import { EventFormatter } from '../util' ;
22import { Channel } from './channel' ;
33
44/**
@@ -87,6 +87,13 @@ export class SocketIoChannel extends Channel {
8787 return this ;
8888 }
8989
90+ /**
91+ * Register a callback to be called anytime an error occurs.
92+ */
93+ error ( callback : Function ) : SocketIoChannel {
94+ return this ;
95+ }
96+
9097 /**
9198 * Bind the channel's socket to an event and store the callback.
9299 */
You can’t perform that action at this time.
0 commit comments