Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
李奇
8 years ago
Commit
1727787fcd1a995eca998104dc88263d7378ca7d
1 parent
5672759c
fixed:链接关闭修改
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
public/js/service/client.page.js
public/js/service/socket-chat.js
public/js/service/client.page.js
View file @
1727787
...
...
@@ -200,6 +200,10 @@ function pageInit() {
connectFailCb
:
function
()
{
$
(
'.connect-fail'
).
fadeIn
();
},
socketClosedCb
:
function
()
{
alert
(
'链接已经断开了,请刷新后重试!'
);
}
}));
}
...
...
public/js/service/socket-chat.js
View file @
1727787
...
...
@@ -7,9 +7,10 @@
var
times
,
param
,
servers
,
socket
,
server
,
servers
,
options
,
connectId
,
conversationMessage
;
...
...
@@ -19,9 +20,10 @@ function _randomServer() {
/**
* socket初始化
* @param opt
ion
s
* @param opts
*/
function
socketInit
(
options
)
{
function
socketInit
(
opts
)
{
options
=
opts
;
servers
=
options
.
servers
;
server
=
_randomServer
();
conversationMessage
=
options
.
conversationMessage
;
...
...
@@ -84,7 +86,7 @@ function sendMsg(msg) {
if
(
socket
.
readyState
===
WebSocket
.
OPEN
)
{
socket
.
send
(
JSON
.
stringify
(
msg
));
}
else
{
console
.
log
(
'The socket is not open.'
);
options
.
socketClosedCb
(
);
}
}
...
...
Please
register
or
login
to post a comment