Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: improve chat example #12

Merged
merged 3 commits into from
Feb 2, 2023

Conversation

L2ncE
Copy link
Member

@L2ncE L2ncE commented Jan 30, 2023

What type of PR is this?

optimize

What this PR does / why we need it (English/Chinese):

en:

  1. When we set it to document.location.host, the default built-in server port number of Goland or other Jetbrains IDEs is 63342. At this time, it cannot be accessed normally, because the port exposed on the backend is 8080. Since the frontendJust to test the service, it is better to hardcode it directly.
  2. In addition, CheckOrigin needs to be set to true, otherwise an error websocket: request origin not allowed by HertzUpgrader.CheckOrigin will be reported.
  3. It is best to change the path of the front-end page to the root path, otherwise an error will be reported when running directly.

zh:

  1. 当我们设置为 document.location.host 时,Goland 或者其他 Jetbrains IDE 的默认内置服务器端口号都是63342,此时是不能正常访问的,因为在后端暴露的端口为8080,既然前端只是为了测试服务,不如直接将其写死。
  2. 除此之外需要将 CheckOrigin 设置为 true,否则会报错 websocket: request origin not allowed by HertzUpgrader.CheckOrigin
  3. 前端页面的路径最好更改为根路径,否则直接运行会报错。

Which issue(s) this PR fixes:

None.

@li-jin-gou li-jin-gou merged commit b7b0e0f into hertz-contrib:main Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants