File tree Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -57,18 +57,9 @@ module.provider('WebSocket', function() {
5757 return this
5858 } ,
5959
60- send : function ( eventName , data , callback ) {
61- if ( angular . isObject ( eventName ) ) {
62- ws . send ( eventName ) ;
63- } else {
64- if ( callback ) {
65- ws . send ( eventName , data , asyncAngularify ( callback ) ) ;
66- } else if ( data ) {
67- ws . send ( eventName , data ) ;
68- } else {
69- ws . send ( eventName ) ;
70- }
71- }
60+ send : function ( message ) {
61+ message = Array . prototype . slice . call ( arguments ) ;
62+ ws . send . apply ( ws , message ) ;
7263 return this ;
7364 } ,
7465
Original file line number Diff line number Diff line change @@ -31,14 +31,16 @@ <h2>WebSocket Test</h2>
3131 $scope . messages = MessagesService . get ( ) ;
3232 $scope . status = TestWebSocket . status ( ) ;
3333
34- WebSocket . onopen ( function ( ) {
35- console . log ( 'connection' ) ;
36- } ) ;
37- WebSocket . send ( 'Hello World' ) ;
3834 WebSocket . onmessage ( function ( event ) {
3935 console . log ( 'message: ' , event ) ;
4036 } ) ;
41-
37+ WebSocket . onclose ( function ( ) {
38+ console . log ( 'closed connection' ) ;
39+ } ) ;
40+ WebSocket . onopen ( function ( ) {
41+ console . log ( 'connection' ) ;
42+ WebSocket . send ( 'Hello World' ) ;
43+ } ) ;
4244
4345 } )
4446 . factory ( 'MessagesService' , function ( $q ) {
You can’t perform that action at this time.
0 commit comments