Skip to content

前后端分离项目中 websocket 的应用 / springboot + vue + websocket + wss

License

Notifications You must be signed in to change notification settings

ekoz/kbase-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kbase-websocket

前后端分离 websocket 的应用 / springboot + vue + websocket + wss

前端 devServer 反向代理 ws

  1. vue.config.js
proxy: {
  "/ws": {
    target: `http://localhost:8080/websocket/`,
    ws: true,
    changeOrigin: true,
    pathRewrite: {
      "/ws": ""
    }
  }
}
  1. new WebSocket
let new_url = getWsLocation("ws/20");
console.log(new_url);
let socket = new WebSocket(
  // "ws://localhost:5000/ws/20"
  new_url
);
  1. nginx 中配置wss反向代理的方法

nginx反向代理WebSocket

【配置】使用nginx反向代理加密websocket (wss)

About

前后端分离项目中 websocket 的应用 / springboot + vue + websocket + wss

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages