@@ -6,32 +6,32 @@ var publisher = OT.initPublisher('publisher');
6
6
7
7
// Attach an event handler for when the session dispatches the 'streamCreated' event.
8
8
session . on ( 'streamCreated' , function ( event ) {
9
- // This function runs when another client publishes a stream (eg. session.publish())
9
+ // This function runs when another client publishes a stream (eg. session.publish())
10
10
11
- // Subscribe to the stream that caused this event, put it inside the DOM element with id='subscribers'
12
- session . subscribe ( event . stream , 'subscribers' , {
13
- insertMode : 'append'
14
- } , function ( error ) {
15
- if ( error ) {
16
- console . error ( 'Failed to subscribe' , error ) ;
17
- }
18
- } ) ;
11
+ // Subscribe to the stream that caused this event, put it inside the DOM element with id='subscribers'
12
+ session . subscribe ( event . stream , 'subscribers' , {
13
+ insertMode : 'append'
14
+ } , function ( error ) {
15
+ if ( error ) {
16
+ console . error ( 'Failed to subscribe' , error ) ;
17
+ }
18
+ } ) ;
19
19
} ) ;
20
20
21
21
// Connect to the Session using the 'apiKey' of the application and a 'token' for permission
22
22
session . connect ( token , function ( error ) {
23
- // This function runs when session.connect() asynchronously completes
23
+ // This function runs when session.connect() asynchronously completes
24
24
25
- // Handle connection errors
26
- if ( error ) {
27
- console . error ( 'Failed to connect' , error ) ;
28
- } else {
29
- // Publish the publisher we initialzed earlier (this will trigger 'streamCreated' on other
30
- // clients)
31
- session . publish ( publisher , function ( error ) {
32
- if ( error ) {
33
- console . error ( 'Failed to publish' , error ) ;
34
- }
35
- } ) ;
36
- }
25
+ // Handle connection errors
26
+ if ( error ) {
27
+ console . error ( 'Failed to connect' , error ) ;
28
+ } else {
29
+ // Publish the publisher we initialzed earlier (this will trigger 'streamCreated' on other
30
+ // clients)
31
+ session . publish ( publisher , function ( error ) {
32
+ if ( error ) {
33
+ console . error ( 'Failed to publish' , error ) ;
34
+ }
35
+ } ) ;
36
+ }
37
37
} ) ;
0 commit comments