Closed shijunti19 closed 5 years ago
After studying for so long, I think EventSource is a very bad design. No wonder nobody uses it. Cook agent is a big problem and nginx agent can cause delays. There are too many things to set up.
Did you looked at https://github.com/dunglas/mercure#401-unauthorized?
vue.config.js
devServer: {
proxy: {
'/api': {
target: 'https://mercure.a031.com',
secure: false,
changeOrigin: true,
pathRewrite: {
'^/api': '' //需要rewrite的
}
}
}
},
let hubUrl = 'https://mercure.a031.com/hub'
if (process.env.NODE_ENV === 'development') {
hubUrl = 'http://localhost:8080/api/hub'这行是重点,我弄了3天,必须是域名http://localhost:8080/api/不然 new URL无效的出错的。
const u = new URL(hubUrl)
}
@dunglas How to empty the pushed data
Every time he refreshes, he reappears, not unsubscribe.
You mean the history?
@dunglas yes! Yes, I delete the database clearance now.
Indeed if you want to flush the history, you just have to delete the db file updates.db
. But what's the benefit of doing this?
@shijunti19 1.I have a lot of trouble developing and debugging. 2.When the page is refreshed,Chat is two dialogues. Now there's only a reply. He's meaningless. 3.I think we should add a setup to close the history. I just want the refresh to be cleared, and the history is loaded by myself through the database.
Does Android's own browser not support SSE now?
vue-cli3 vue My local address:http://localhost:8080/#/chat/index Server address:https://mercure.a031.com/ I use EventSource
Unauthorized
I will not change the domain name of cookie, how to solve it