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
5672759c29022c0ad39b54febd534bf8bbb70c12
1 parent
2801fbf7
fixed:代码优化
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
public/js/service/socket-chat.js
public/js/service/socket-chat.js
View file @
5672759
...
...
@@ -55,22 +55,21 @@ function socketInit(options) {
* @returns {WebSocket}
*/
function
socketConnect
()
{
console
.
log
(
'server'
,
server
);
var
instance
=
new
WebSocket
(
server
+
'/im?param='
+
param
);
var
socket
=
new
WebSocket
(
server
+
'/im?param='
+
param
);
instance
.
onmessage
=
options
.
onMessage
||
function
()
{
console
.
log
(
'received msg'
);
};
socket
.
onmessage
=
options
.
onMessage
||
function
()
{
console
.
log
(
'received msg'
);
};
instance
.
onopen
=
options
.
onOpen
||
function
()
{
console
.
log
(
'websocket is open'
);
};
socket
.
onopen
=
options
.
onOpen
||
function
()
{
console
.
log
(
'websocket is open'
);
};
instance
.
onclose
=
options
.
onClose
||
function
()
{
console
.
log
(
'websocket is closed'
);
};
socket
.
onclose
=
options
.
onClose
||
function
()
{
console
.
log
(
'websocket is closed'
);
};
return
instance
;
return
socket
;
}
}
...
...
Please
register
or
login
to post a comment