|
@@ -6,8 +6,9 @@ export default class HcSocket {
|
|
|
|
|
|
static socket = null
|
|
|
|
|
|
- static create(data, change) {
|
|
|
- const socket = new WebSocket(website.socket + data)
|
|
|
+ static create({ projectId, contractId, userId }, change) {
|
|
|
+ const url = `${website.socket}/${website.clientId}/${projectId}/${contractId}/${userId}`
|
|
|
+ const socket = new WebSocket(url)
|
|
|
socket.onopen = function () {
|
|
|
console.log('websocket 链接成功')
|
|
|
}
|
|
@@ -15,6 +16,7 @@ export default class HcSocket {
|
|
|
console.log('websocket 链接已断开')
|
|
|
}
|
|
|
socket.onmessage = function ({ data }) {
|
|
|
+ console.log(data)
|
|
|
if (typeof change !== 'function') {
|
|
|
return false
|
|
|
} else {
|