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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
love_飞影
Neos
Commits
ff57d4f6
Commit
ff57d4f6
authored
Jun 04, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update stream.ts
parent
bb640b14
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
123 deletions
+13
-123
neos.config.json
neos.config.json
+2
-61
neos.config.prod.json
neos.config.prod.json
+2
-61
src/infra/stream.ts
src/infra/stream.ts
+9
-1
No files found.
neos.config.json
View file @
ff57d4f6
...
...
@@ -11,71 +11,12 @@
"cardsDbUrl"
:
"https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb"
,
"stringsUrl"
:
"https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf"
,
"chainALL"
:
false
,
"streamInterval"
:
200
,
"ui"
:{
"ground"
:{
"width"
:
9.9
,
"height"
:
8
},
"card"
:{
"transform"
:{
"x"
:
0.8
,
"y"
:
1
,
"z"
:
0.05
},
"rotation"
:{
"x"
:
1.55
,
"y"
:
0
,
"z"
:
0
},
"reverseRotation"
:{
"x"
:
1.55
,
"y"
:
3.1
,
"z"
:
0
},
"defenceRotation"
:{
"x"
:
1.55
,
"y"
:
1.55
,
"z"
:
0
},
"handRotation"
:{
"x"
:
1
,
"y"
:
0
,
"z"
:
0
},
"handHoverScaling"
:{
"x"
:
1.2
,
"y"
:
1.2
,
"z"
:
1
},
"floating"
:
0.02
},
"layout"
:{
"header"
:{
"height"
:
80
},
"content"
:{
"height"
:
800
},
"sider"
:{
"width"
:
300
},
"footer"
:{
"height"
:
80
}
},
"status"
:{
"avatarSize"
:
40
,
"meAvatarColor"
:
"#0e63e1"
,
"opAvatarColor"
:
"#e10e68"
},
"hint"
:{
"waitingDuration"
:
1.5
,
"maxCount"
:
1
},
"commonDelay"
:
200
,
"moveDelay"
:
500
,
"chainingDelay"
:
800
,
"attackDelay"
:
500
}
},
"unimplementedWhiteList"
:[
1
,
...
...
neos.config.prod.json
View file @
ff57d4f6
...
...
@@ -11,71 +11,12 @@
"cardsDbUrl"
:
"https://cdn02.moecube.com:444/ygopro-database/zh-CN/cards.cdb"
,
"stringsUrl"
:
"https://cdn02.moecube.com:444/ygopro-database/zh-CN/strings.conf"
,
"chainALL"
:
false
,
"streamInterval"
:
200
,
"ui"
:{
"ground"
:{
"width"
:
9.9
,
"height"
:
8
},
"card"
:{
"transform"
:{
"x"
:
0.8
,
"y"
:
1
,
"z"
:
0.05
},
"rotation"
:{
"x"
:
1.55
,
"y"
:
0
,
"z"
:
0
},
"reverseRotation"
:{
"x"
:
1.55
,
"y"
:
3.1
,
"z"
:
0
},
"defenceRotation"
:{
"x"
:
1.55
,
"y"
:
1.55
,
"z"
:
0
},
"handRotation"
:{
"x"
:
1
,
"y"
:
0
,
"z"
:
0
},
"handHoverScaling"
:{
"x"
:
1.2
,
"y"
:
1.2
,
"z"
:
1
},
"floating"
:
0.02
},
"layout"
:{
"header"
:{
"height"
:
80
},
"content"
:{
"height"
:
800
},
"sider"
:{
"width"
:
300
},
"footer"
:{
"height"
:
80
}
},
"status"
:{
"avatarSize"
:
40
,
"meAvatarColor"
:
"#0e63e1"
,
"opAvatarColor"
:
"#e10e68"
},
"hint"
:{
"waitingDuration"
:
1.5
,
"maxCount"
:
1
},
"commonDelay"
:
200
,
"moveDelay"
:
500
,
"chainingDelay"
:
800
,
"attackDelay"
:
500
}
},
"unimplementedWhiteList"
:[
1
,
...
...
src/infra/stream.ts
View file @
ff57d4f6
...
...
@@ -2,6 +2,11 @@
// 现在我们有这样一个需求:需要保证每次只处理一个消息,在上一个消息处理完后,再进行下一个消息的处理。
//
// 因此封装了一个`WebSocketStream`类,当每次Websocket连接中有消息到达时,往流中添加event,
import
{
useConfig
}
from
"
@/config
"
;
import
{
sleep
}
from
"
./sleep
"
;
// 同时执行器会不断地从流中获取event进行处理。
export
class
WebSocketStream
{
public
ws
:
WebSocket
;
...
...
@@ -48,7 +53,10 @@ export class WebSocketStream {
return
;
}
else
{
// websocket not closed, handle next message from server
// websocket not closed, wait some time, and then handle next message from server
await
sleep
(
useConfig
().
streamInterval
);
return
reader
.
read
().
then
(
process
);
}
}
...
...
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