websocket调整&ibp设备配置调整
This commit is contained in:
parent
88253207d8
commit
0c08e93ba1
@ -32,7 +32,6 @@
|
||||
"recordrtc": "^5.5.9",
|
||||
"script-loader": "^0.7.2",
|
||||
"sessionstorage": "^0.1.0",
|
||||
"sockjs-client": "^1.4.0",
|
||||
"stompjs": "^2.3.3",
|
||||
"storejs": "^1.0.25",
|
||||
"three": "^0.107.0",
|
||||
|
@ -1,19 +1,17 @@
|
||||
import SockJS from 'sockjs-client';
|
||||
import Stomp from 'stompjs';
|
||||
import { getBaseUrl } from '@/utils/baseUrl';
|
||||
|
||||
const BASE_API = getBaseUrl();
|
||||
let baseUrl = "http://192.168.3.6:9600";//本地旭强
|
||||
if(BASE_API == 'https://joylink.club/jlcloud'){
|
||||
baseUrl = "https://joylink.club/relay";
|
||||
}else if(BASE_API == 'https://test.joylink.club/jlcloud'){
|
||||
baseUrl = "https://test.joylink.club/relay";
|
||||
let baseUrl = 'http://192.168.3.6:9600';// 本地旭强
|
||||
if (BASE_API == 'https://joylink.club/jlcloud') {
|
||||
baseUrl = 'https://joylink.club/relay';
|
||||
} else if (BASE_API == 'https://test.joylink.club/jlcloud') {
|
||||
baseUrl = 'https://test.joylink.club/relay';
|
||||
}
|
||||
|
||||
class StompClient {
|
||||
|
||||
constructor() {
|
||||
const ws = new SockJS(`${baseUrl}/ws-relay`);
|
||||
const ws = new WebSocket(`${baseUrl}/ws-relay`.replace(/https/, 'wss').replace(/http/, 'ws'));
|
||||
this.client = Stomp.over(ws);
|
||||
this.client.debug = function (message) {
|
||||
console.debug(message);
|
||||
|
@ -2,9 +2,9 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
|
@ -3,7 +3,6 @@ import { checkLoginLine } from '@/api/login';
|
||||
import { getBaseUrl } from '@/utils/baseUrl';
|
||||
import { MessageBox } from 'element-ui';
|
||||
import store from '@/store/index_APP_TARGET';
|
||||
import SockJS from 'sockjs-client';
|
||||
import Stomp from 'stompjs';
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
@ -19,7 +18,7 @@ var StompClient = function (headers) {
|
||||
};
|
||||
|
||||
StompClient.prototype = {
|
||||
socket: null,
|
||||
websocket: null,
|
||||
clientIns: null,
|
||||
url: '',
|
||||
status: false,
|
||||
@ -34,27 +33,10 @@ StompClient.prototype = {
|
||||
|
||||
// 连接服务端
|
||||
connect() {
|
||||
// 建立连接对象(还未发起连接)
|
||||
// (null, {transports:['websocket']})虽可以解决连接关闭后xhr_streaming无限循环
|
||||
// 但是该参数只会允许websockets,若不支持,直接报错
|
||||
// 注意sockjs会做降级处理,优先处理websockets,若浏览器不支持websockets
|
||||
// 则会降级为xhr_streaming(轮询),继续不支持的时候会降级为xhr-polling
|
||||
|
||||
// const oldtransportClose = SockJS.prototype._transportClose;
|
||||
// SockJS.prototype._transportClose = function(code, reason) {
|
||||
// // To do
|
||||
// // ...
|
||||
// console.log(reason + '-----------------', this._transport);
|
||||
// if (this._transport && this._transport.close) {
|
||||
// this._transport.close();
|
||||
// }
|
||||
// return oldtransportClose.call(this, code, reason);
|
||||
// };
|
||||
|
||||
// 向服务器发起websocket连接并发送CONNECT帧
|
||||
this.socket = new SockJS(websocketUrl + getToken());
|
||||
this.websocket = new WebSocket(this.url.replace(/https/, 'wss').replace(/http/, 'ws'));
|
||||
// 获取 STOMP 子协议的客户端对象
|
||||
this.clientIns = Stomp.over(this.socket);
|
||||
this.clientIns = Stomp.over(this.websocket);
|
||||
this.closeStompDebug();
|
||||
const that = this;
|
||||
this.clientIns.connect({ 'X-Token': getToken() }, () => {
|
||||
@ -70,7 +52,6 @@ StompClient.prototype = {
|
||||
});
|
||||
// sock断开回调
|
||||
that.clientIns.ws.onclose = () => {
|
||||
// Message.error(`通信连接已断开!`);
|
||||
console.info(`通信连接已断开!`);
|
||||
checkLoginLine().then(() => {
|
||||
that.count++;
|
||||
@ -161,8 +142,8 @@ StompClient.prototype = {
|
||||
this.clientIns.disconnect();
|
||||
}
|
||||
this.isPassived = false;
|
||||
this.socket.close();
|
||||
this.socket = null;
|
||||
this.websocket.close();
|
||||
this.websocket = null;
|
||||
this.clientIns = null;
|
||||
}
|
||||
this.status = false;
|
||||
|
@ -279,7 +279,6 @@ import { getDeviceDetail, setIbpConfig} from '@/api/project';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import { getAllMapOnline, getStationListNeedAttendant } from '@/api/jmap/map';
|
||||
const propMap = {
|
||||
addr: '网关位地址',
|
||||
ribpsd: 'IBP盘试灯按钮',
|
||||
wibpsdand: 'IBP盘试灯指示灯',
|
||||
afczjConfig: {
|
||||
@ -446,7 +445,7 @@ const propMap = {
|
||||
rxxsd: '下行试灯按钮[信号配置]',
|
||||
wfmq: '蜂鸣器[信号配置]',
|
||||
wsxjjtccand: '上行紧急停车按钮灯[信号配置]',
|
||||
wsxjjtczsd: '上行取消紧急停车指示灯[信号配置]',
|
||||
wsxjjtczsd: '上行紧急停车指示灯[信号配置]',
|
||||
wsxjljcand: '上行警铃解除按钮灯[信号配置]',
|
||||
wsxkcand: '上行扣车按钮灯[信号配置]',
|
||||
wsxkczsd: '上行扣车指示灯[信号配置]',
|
||||
@ -455,7 +454,7 @@ const propMap = {
|
||||
wsxqxkczsd: '上行取消扣车指示灯[信号配置]',
|
||||
wsxsdand: '上行试灯按钮灯[信号配置]',
|
||||
wxxjjtccand: '下行紧急停车按钮灯[信号配置]',
|
||||
wxxjjtczsd: '下行取消紧急停车按钮灯[信号配置]',
|
||||
wxxjjtczsd: '下行紧急停车指示灯[信号配置]',
|
||||
wxxjljcand: '下行警铃解除按钮灯[信号配置]',
|
||||
wxxkcand: '下行扣车按钮灯[信号配置]',
|
||||
wxxkczsd: '下行扣车指示灯[信号配置]',
|
||||
@ -711,7 +710,7 @@ export default {
|
||||
items:[
|
||||
{ prop:'wfmq', label: '蜂鸣器:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wsxjjtccand', label: '上行紧急停车按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wsxjjtczsd', label: '上行取消紧急停车指示灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wsxjjtczsd', label: '上行紧急停车指示灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wsxjljcand', label: '上行警铃解除按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wsxkcand', label: '上行扣车按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wsxkczsd', label: '上行扣车指示灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
@ -720,7 +719,7 @@ export default {
|
||||
{ prop:'wsxqxkczsd', label: '上行取消扣车指示灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wsxsdand', label: '上行试灯按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wxxjjtccand', label: '下行紧急停车按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wxxjjtczsd', label: '下行取消紧急停车按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wxxjjtczsd', label: '下行紧急停车指示灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wxxjljcand', label: '下行警铃解除按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wxxkcand', label: '下行扣车按钮灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
{ prop:'wxxkczsd', label: '下行扣车指示灯:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, size: 'small', noControls: true},
|
||||
|
Loading…
Reference in New Issue
Block a user