Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liveserver
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何硕
liveserver
Commits
4bf6dc80
Commit
4bf6dc80
authored
Aug 27, 2019
by
何硕
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'heshuo' into 'master'
login See merge request
!27
parents
e5a07cd4
23f38f23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
index.js
index.js
+3
-4
No files found.
index.js
View file @
4bf6dc80
...
...
@@ -19,22 +19,21 @@ io.on('connection', function(socket){
socket
.
on
(
'
login
'
,
function
(
obj
){
var
userid
=
obj
.
userid
;
var
roomid
=
obj
.
roomid
;
var
status
=
obj
.
status
;
//用户状态
socket
.
nickname
=
roomid
+
'
***
'
+
userid
;
console
.
log
(
"
login------------------
"
+
socket
.
nickname
);
socket
.
join
(
roomid
);
// 加入房间
axios
.
post
(
BaseUrl
+
'
websocket/login
'
,
{
roomid
:
roomid
,
userid
:
userid
,
status
:
status
userid
:
userid
})
.
then
(
function
(
response
)
{
console
.
log
(
response
.
data
);
var
str
=
socket
.
nickname
.
split
(
"
***
"
);
var
userid
=
str
[
1
];
var
roomid
=
str
[
0
];
io
.
to
(
roomid
).
emit
(
'
Login
'
,
{
userid
:
userid
,
roomid
:
roomid
});
console
.
log
(
response
.
data
.
meta
.
code
);
io
.
to
(
roomid
).
emit
(
'
Login
'
,
{
userid
:
userid
,
roomid
:
roomid
,
code
:
response
.
data
.
meta
.
code
});
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment