File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ function main() {
57
57
appId : appId ,
58
58
clientId : clientId
59
59
} ) ;
60
-
61
60
// 监听连接成功事件
62
61
rt . on ( 'open' , function ( ) {
63
62
firstFlag = false ;
Original file line number Diff line number Diff line change @@ -1011,7 +1011,7 @@ void function(win) {
1011
1011
// 表示关闭当前的 session 连接和 WebSocket 连接,并且回收内存
1012
1012
close : function ( ) {
1013
1013
if ( ! cache . openFlag ) {
1014
- throw ( 'Use close() must after open() has successed.' ) ;
1014
+ throw ( 'Must call after open() has successed.' ) ;
1015
1015
}
1016
1016
cache . closeFlag = true ;
1017
1017
engine . closeSession ( ) ;
@@ -1035,6 +1035,9 @@ void function(win) {
1035
1035
return this ;
1036
1036
} ,
1037
1037
room : function ( argument , callback ) {
1038
+ if ( ! cache . openFlag ) {
1039
+ throw ( 'Must call after open() has successed.' ) ;
1040
+ }
1038
1041
var convObject = newConvObject ( cache ) ;
1039
1042
// 传入 convId
1040
1043
if ( typeof argument === 'string' ) {
@@ -1103,6 +1106,9 @@ void function(win) {
1103
1106
} ,
1104
1107
// 相关查询,包括用户列表查询,房间查询等
1105
1108
query : function ( argument , callback ) {
1109
+ if ( ! cache . openFlag ) {
1110
+ throw ( 'Must call after open() has successed.' ) ;
1111
+ }
1106
1112
var options = { } ;
1107
1113
switch ( arguments . length ) {
1108
1114
// 如果只有一个参数,那么是 callback
@@ -1128,6 +1134,9 @@ void function(win) {
1128
1134
} ,
1129
1135
// 判断用户是否在线
1130
1136
ping : function ( argument , callback ) {
1137
+ if ( ! cache . openFlag ) {
1138
+ throw ( 'Must call after open() has successed.' ) ;
1139
+ }
1131
1140
if ( ! callback ) {
1132
1141
throw ( 'Ping must have callback.' ) ;
1133
1142
}
You can’t perform that action at this time.
0 commit comments