Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
wangpeng
dinky
Commits
dabb4d87
Unverified
Commit
dabb4d87
authored
Aug 10, 2023
by
yqwoe
Committed by
GitHub
Aug 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix][Web] Fix web SSE problem (#2191)
* feat: use-service hooks * feat: SSE express代理 * Update MonitorController.java --------- Co-authored-by:
zhu-mingye
<
934230207@qq.com
>
parent
a08b334d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
MonitorController.java
...src/main/java/org/dinky/controller/MonitorController.java
+0
-2
proxy.ts
dinky-web/config/proxy.ts
+11
-1
api.ts
dinky-web/src/services/api.ts
+1
-6
No files found.
dinky-admin/src/main/java/org/dinky/controller/MonitorController.java
View file @
dabb4d87
...
...
@@ -34,7 +34,6 @@ import java.util.Map;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -66,7 +65,6 @@ public class MonitorController {
}
@GetMapping
(
value
=
"/getLastUpdateData"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@CrossOrigin
(
"*"
)
@PublicInterface
@ApiOperation
(
"Get Last Update Data"
)
public
SseEmitter
getLastUpdateData
(
Long
lastTime
)
{
...
...
dinky-web/config/proxy.ts
View file @
dabb4d87
...
...
@@ -36,9 +36,19 @@ export default {
// target: 'https://preview.pro.ant.design',
// 配置了这个可以从 http 代理到 https
// 依赖 origin 的功能可能需要这个,比如 cookie
secure
:
false
,
changeOrigin
:
true
,
logLevel
:
'debug'
,
pathRewrite
:
{
'^'
:
''
},
}
onProxyRes
:
(
proxyRes
,
req
,
res
)
=>
{
res
.
header
({
'Content-Type'
:
'text/event-stream'
,
'Cache-Control'
:
'no-cache, no-transform'
,
Connection
:
'keep-alive'
,
'X-Accel-Buffering'
:
'noe'
,
});
},
},
},
/**
...
...
dinky-web/src/services/api.ts
View file @
dabb4d87
...
...
@@ -87,12 +87,7 @@ export async function removeData(url: string, params: [any]) {
});
}
export
function
getSseData
(
url
:
string
)
{
const
{
REACT_APP_ENV
=
'dev'
}
=
process
.
env
;
// @ts-ignore
const
address
=
proxy
[
REACT_APP_ENV
][
"/api/"
].
target
||
""
return
new
EventSource
(
address
+
url
);
return
new
EventSource
(
url
);
}
...
...
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