@@ -137,7 +137,7 @@ export function decodePacket (data, binaryType, utf8decode) {
|
137 | 137 | type = data.charAt(0);
|
138 | 138 |
|
139 | 139 | if (type === 'b') {
|
140 |
| -return decodeBase64Packet(data.substr(1), binaryType); |
| 140 | +return decodeBase64Packet(data.slice(1), binaryType); |
141 | 141 | }
|
142 | 142 |
|
143 | 143 | if (utf8decode) {
|
@@ -152,7 +152,7 @@ export function decodePacket (data, binaryType, utf8decode) {
|
152 | 152 | }
|
153 | 153 |
|
154 | 154 | if (data.length > 1) {
|
155 |
| -return { type: packetslist[type], data: data.substring(1) }; |
| 155 | +return { type: packetslist[type], data: data.slice(1) }; |
156 | 156 | } else {
|
157 | 157 | return { type: packetslist[type] };
|
158 | 158 | }
|
@@ -191,7 +191,7 @@ function tryDecode(data) {
|
191 | 191 |
|
192 | 192 | export function decodeBase64Packet (msg, binaryType) {
|
193 | 193 | var type = packetslist[msg.charAt(0)];
|
194 |
| -var data = Buffer.from(msg.substr(1), 'base64'); |
| 194 | +var data = Buffer.from(msg.slice(1), 'base64'); |
195 | 195 | if (binaryType === 'arraybuffer') {
|
196 | 196 | var abv = new Uint8Array(data.length);
|
197 | 197 | for (var i = 0; i < abv.length; i++){
|
@@ -305,7 +305,7 @@ export function decodePayload (data, binaryType, callback) {
|
305 | 305 | return callback(err, 0, 1);
|
306 | 306 | }
|
307 | 307 |
|
308 |
| -msg = data.substr(i + 1, n); |
| 308 | +msg = data.slice(i + 1, i + 1 + n); |
309 | 309 |
|
310 | 310 | if (length != msg.length) {
|
311 | 311 | // parser error - ignoring payload
|
|
0 commit comments