New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wireapp/api-client

Package Overview
Dependencies
Maintainers
6
Versions
1434
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wireapp/api-client - npm Package Compare versions

Comparing version 0.0.19 to 0.0.21

browser/ws-fallback.js

6

dist/commonjs/core/WireAPIClient.js

@@ -62,3 +62,3 @@ "use strict";

};
WireAPIClient.prototype.listen = function (clientId) {
WireAPIClient.prototype.connect = function (clientId) {
var _this = this;

@@ -71,5 +71,7 @@ return this.client.ws.connect(clientId)

};
return socket;
});
};
WireAPIClient.prototype.disconnect = function () {
this.client.ws.disconnect();
};
return WireAPIClient;

@@ -76,0 +78,0 @@ }(EventEmitter));

@@ -9,2 +9,3 @@ "use strict";

WebSocketClient.prototype.connect = function (clientId) {
var _this = this;
var url = this.baseURL + "/await?access_token=" + this.accessToken

@@ -15,12 +16,21 @@ .access_token;

}
var socket = new WebSocket(url);
socket.binaryType = 'arraybuffer';
this.socket = new WebSocket(url);
this.socket.binaryType = 'arraybuffer';
return new Promise(function (resolve) {
socket.onopen = function () {
resolve(socket);
_this.socket.onopen = function () {
resolve(_this.socket);
};
});
};
WebSocketClient.prototype.disconnect = function () {
if (this.socket) {
this.socket.close();
this.socket = undefined;
}
else {
throw new Error('Attempt for closing non-existent WebSocket.');
}
};
return WebSocketClient;
}());
exports.default = WebSocketClient;

@@ -27,2 +27,7 @@ import WireAPIClient from "./commonjs";

const client = new WireAPIClient(urls);
client.on(WireAPIClient.TOPIC.WEB_SOCKET_MESSAGE, function(notification) {
console.log('Received notification via WebSocket', notification);
});
client.login(login)

@@ -33,2 +38,3 @@ .then((result) => {

submitButton.firstChild.data = "😊";
return client.connect();
})

@@ -35,0 +41,0 @@ .catch((error) => {

@@ -26,2 +26,3 @@ const argv = require('optimist')

const client = new WireAPIClient(urls);
client.on(WireAPIClient.TOPIC.WEB_SOCKET_MESSAGE, function(notification) {

@@ -28,0 +29,0 @@ console.log('Received notification via WebSocket', notification);

{
"author": "Wire",
"browser": {
"ws": "./ws-fallback.js"
"ws": "./browser/ws-fallback.js"
},

@@ -53,3 +53,3 @@ "dependencies": {

},
"version": "0.0.19"
"version": "0.0.21"
}

@@ -52,1 +52,6 @@ -----

```
```bash
npm run dist
node dist/index.js --e="name@email.com" --p="password"
```

@@ -61,6 +61,5 @@ import * as WebSocket from 'ws';

public listen(clientId: string): Promise<WebSocket> {
public connect(clientId: string): Promise<void> {
return this.client.ws.connect(clientId)
.then((socket: WebSocket) => {
socket.onmessage = (event: { data: any; type: string; target: WebSocket }) => {

@@ -70,6 +69,8 @@ const notification = JSON.parse(Buffer.from(event.data).toString('utf8'));

};
return socket;
});
}
public disconnect(): void {
this.client.ws.disconnect();
}
}

@@ -5,2 +5,3 @@ import * as WebSocket from 'ws';

public accessToken: AccessTokenData;
private socket: WebSocket;

@@ -16,11 +17,20 @@ constructor(public baseURL: string) {}

const socket = new WebSocket(url);
socket.binaryType = 'arraybuffer';
this.socket = new WebSocket(url);
this.socket.binaryType = 'arraybuffer';
return new Promise((resolve) => {
socket.onopen = () => {
resolve(socket);
this.socket.onopen = () => {
resolve(this.socket);
};
});
}
public disconnect() {
if (this.socket) {
this.socket.close();
this.socket = undefined;
} else {
throw new Error('Attempt for closing non-existent WebSocket.');
}
}
}

@@ -5,2 +5,3 @@ {

"lib": [
"DOM",
"ES6"

@@ -20,3 +21,2 @@ ],

"exclude": [
"bower_components",
"dist/commonjs",

@@ -23,0 +23,0 @@ "node_modules"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc