File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ <h2>WebSocket Test</h2>
15
15
< div id ="output " ng-repeat ="message in messages ">
16
16
Message: {{ message.text }} < small > {{ message.created_at | date }}</ small >
17
17
</ div >
18
+
19
+
18
20
</ div >
19
21
20
22
< script language ="javascript " type ="text/javascript ">
@@ -32,15 +34,18 @@ <h2>WebSocket Test</h2>
32
34
$scope . status = TestWebSocket . status ( ) ;
33
35
34
36
WebSocket . onmessage ( function ( event ) {
35
- console . log ( 'message: ' , event ) ;
37
+ console . log ( 'message: ' , event . data ) ;
36
38
} ) ;
37
39
WebSocket . onclose ( function ( ) {
38
- console . log ( 'closed connection' ) ;
40
+ console . log ( 'connection closed ' ) ;
39
41
} ) ;
40
42
WebSocket . onopen ( function ( ) {
41
- console . log ( 'connection' ) ;
43
+ console . log ( 'connection open ' ) ;
42
44
WebSocket . send ( 'Hello World' ) ;
43
45
} ) ;
46
+ setTimeout ( function ( ) {
47
+ WebSocket . close ( ) ;
48
+ } , 500 )
44
49
45
50
} )
46
51
. factory ( 'MessagesService' , function ( $q ) {
You can’t perform that action at this time.
0 commit comments