Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
2439957d
Commit
2439957d
authored
Jul 10, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update middleware/socket.ts
parent
8934af06
Pipeline
#22612
passed with stages
in 13 minutes and 5 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
src/middleware/socket.ts
src/middleware/socket.ts
+9
-1
No files found.
src/middleware/socket.ts
View file @
2439957d
...
@@ -26,6 +26,8 @@ export interface socketAction {
...
@@ -26,6 +26,8 @@ export interface socketAction {
player
:
string
;
player
:
string
;
passWd
:
string
;
passWd
:
string
;
};
};
isReplay
?:
boolean
;
// 是否是回放模式
replayUrl
?:
string
;
// 提供回放服务的地址,当`isReplay`为true时,必传
// 通过长连接发送的数据
// 通过长连接发送的数据
payload
?:
Uint8Array
;
payload
?:
Uint8Array
;
}
}
...
@@ -36,12 +38,18 @@ let ws: WebSocketStream | null = null;
...
@@ -36,12 +38,18 @@ let ws: WebSocketStream | null = null;
export
default
async
function
(
action
:
socketAction
)
{
export
default
async
function
(
action
:
socketAction
)
{
switch
(
action
.
cmd
)
{
switch
(
action
.
cmd
)
{
case
socketCmd
.
CONNECT
:
{
case
socketCmd
.
CONNECT
:
{
const
info
=
action
.
initInfo
;
const
{
initInfo
:
info
,
isReplay
,
replayUrl
}
=
action
;
if
(
info
)
{
if
(
info
)
{
ws
=
new
WebSocketStream
(
info
.
ip
,
(
conn
,
_event
)
=>
ws
=
new
WebSocketStream
(
info
.
ip
,
(
conn
,
_event
)
=>
handleSocketOpen
(
conn
,
info
.
ip
,
info
.
player
,
info
.
passWd
)
handleSocketOpen
(
conn
,
info
.
ip
,
info
.
player
,
info
.
passWd
)
);
);
await
ws
.
execute
(
handleSocketMessage
);
}
else
if
(
isReplay
&&
replayUrl
)
{
ws
=
new
WebSocketStream
(
replayUrl
,
()
=>
console
.
info
(
"
replay websocket open.
"
)
);
await
ws
.
execute
(
handleSocketMessage
);
await
ws
.
execute
(
handleSocketMessage
);
}
}
...
...
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