File tree Expand file tree Collapse file tree 3 files changed +72
-1
lines changed Expand file tree Collapse file tree 3 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ var EzyFoxServerClientPlugin = {
86
86
. getClient ( clientName )
87
87
. send ( cmd , sendData ) ;
88
88
} ,
89
+ 'startPing' : function ( clientName , callback ) {
90
+ EzyLogger . console ( 'start ping: clientName = ' + clientName ) ;
91
+ ezy . client . pingSchedule . start ( ) ;
92
+ } ,
93
+ 'stopPing' : function ( clientName , callback ) {
94
+ EzyLogger . console ( 'start ping: clientName = ' + clientName ) ;
95
+ ezy . client . pingSchedule . stop ( ) ;
96
+ } ,
89
97
}
90
98
} ,
91
99
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public EzyWSClient(EzyClientConfig config)
38
38
this . config = config ;
39
39
this . status = EzyConnectionStatus . NULL ;
40
40
this . pingManager = new EzySimplePingManager ( config . getPing ( ) ) ;
41
- this . pingSchedule = new EzyPingSchedule ( this ) ;
41
+ this . pingSchedule = new EzyWSPingSchedule ( this ) ;
42
42
this . handlerManager = new EzySimpleHandlerManager ( this ) ;
43
43
this . settingUp = new EzySimpleSetup ( handlerManager ) ;
44
44
}
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using AOT ;
3
+ using com . tvd12 . ezyfoxserver . client . logger ;
4
+ using com . tvd12 . ezyfoxserver . client . socket ;
5
+
6
+ namespace com . tvd12 . ezyfoxserver . client . unity
7
+ {
8
+ public class EzyWSPingSchedule : EzyPingSchedule
9
+ {
10
+ private static readonly EzyLogger LOGGER = EzyUnityLoggerFactory . getLogger ( typeof ( EzyWSPingSchedule ) ) ;
11
+
12
+ public EzyWSPingSchedule ( EzyClient client ) : base ( client )
13
+ {
14
+ }
15
+
16
+ public override void start ( )
17
+ {
18
+ EzyWSProxy . run3 (
19
+ client . getName ( ) ,
20
+ "startPing" ,
21
+ startPingCallback
22
+ ) ;
23
+ }
24
+
25
+ [ MonoPInvokeCallback ( typeof ( EzyDelegates . Delegate2 ) ) ]
26
+ public static void startPingCallback (
27
+ String clientName ,
28
+ String jsonData
29
+ )
30
+ {
31
+ LOGGER . debug (
32
+ "startPingCallback: clientName = " +
33
+ clientName + ", jsonData = " + jsonData
34
+ ) ;
35
+ }
36
+
37
+ public override void stop ( )
38
+ {
39
+ EzyWSProxy . run3 (
40
+ client . getName ( ) ,
41
+ "stopPing" ,
42
+ stopPingCallback
43
+ ) ;
44
+ }
45
+
46
+ [ MonoPInvokeCallback ( typeof ( EzyDelegates . Delegate2 ) ) ]
47
+ public static void stopPingCallback (
48
+ String clientName ,
49
+ String jsonData
50
+ )
51
+ {
52
+ LOGGER . debug (
53
+ "stopPingCallback: clientName = " +
54
+ clientName + ", jsonData = " + jsonData
55
+ ) ;
56
+ }
57
+
58
+ public override void setSocketEventQueue ( EzySocketEventQueue socketEventQueue )
59
+ {
60
+ throw new InvalidOperationException ( "not supported" ) ;
61
+ }
62
+ }
63
+ }
You can’t perform that action at this time.
0 commit comments