Skip to content

Commit

Permalink
Correct set 'ws' property on component in websocket mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
movitto committed Dec 19, 2019
1 parent 3f04874 commit dd3509a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mixins/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ module.exports = {

methods : {
init_ws : function(){
ws = new WebSocket("wss://s1.ripple.com:443");
ws.onopen = function(){
this.ws = new WebSocket("wss://s1.ripple.com:443");
this.ws.onopen = function(){
var json = JSON.stringify({
'command' : 'subscribe',
'streams' : ["transactions"],
});
ws.send(json);
}
this.ws.send(json);
}.bind(this)

ws.onmessage = function (event) {
this.ws.onmessage = function (event) {
var json = JSON.parse(event.data);
if(!json["transaction"]) return;

Expand All @@ -38,7 +38,7 @@ module.exports = {
if(now - this.last_tx_time > WS_TIMEOUT){
this.connecting = true;

ws.close();
this.ws.close();
this.init_ws();
this.last_tx_time = now;
}
Expand Down

0 comments on commit dd3509a

Please sign in to comment.