#### 计划js层websocket连接,使用加密websocket连接,并包含对应标签,以跟原业务区别。 - 终端目前提供了非安全的websocket(端口为9002),以及安全的websocket(端口为9003,数据加密方式为SM2)。 - 当前旧的业务端、关门页等用的都是非安全的websocket。 - js层调用是否都采用安全的websocket,并在连接的时候提供**标记**,这样能基于连接返回不一样的内容,也能使数据加密,连接更加安全。 - 示例: ``` const headers = { 'Sec-WebSocket-Protocol': 'name=客户端名称' }; const ws = new WebSocket('ws://example.com/socket', { headers }); ``` - 对于要求的返回不同字段,对加密websocket,可以有**不同的返回值字段。** #### 计划js层接口,拟全部采用新的交互数据接口,预估会影响到Request、RequestAck、Event、Info类型的数据 - 参考,使用{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}包装参数字段,避免重复: ``` { "{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}": { "account": "6214836668689199", "confirm": 0, "encrypt": 1, "length": 6, "reserved1": 0, "reserved2": 0, "reserved3": "", "reserved4": "", "smflag": 0, "timeout": 0 }, "class": "PinPadService", "className": "PinPadService", "entity": "PinPad", "entityName": "PinPad", "messageType": 3, "methodID": 6, "MethodSignature": -1531281659, "sessionID": 1818682325, "signature": -1531281659, "timeout": 60000, "transID": 97 } ```