@@ -68,11 +68,12 @@ function errorToConsole($message) {
6868
6969class Bitvavo {
7070 public function __construct ($ options ) {
71- $ this ->base = "https://api.bitvavo.com/v2 " ;
7271 $ apiKeySet = false ;
7372 $ apiSecretSet = false ;
7473 $ accessWindowSet = false ;
7574 $ debuggingSet = false ;
75+ $ restUrlSet = false ;
76+ $ wsUrlSet = false ;
7677 foreach ($ options as $ key => $ value ) {
7778 if (strtolower ($ key ) == "apikey " ) {
7879 $ this ->apiKey = $ value ;
@@ -86,6 +87,12 @@ public function __construct($options) {
8687 } else if (strtolower ($ key ) == "debugging " ) {
8788 $ this ->debugging = (bool )$ value ;
8889 $ debuggingSet = true ;
90+ } else if (strtolower ($ key ) === 'resturl ' ) {
91+ $ this ->base = $ value ;
92+ $ restUrlSet = true ;
93+ } else if (strtolower ($ key ) === 'wsurl ' ) {
94+ $ this ->wsurl = $ value ;
95+ $ wsUrlSet = true ;
8996 }
9097 }
9198 if (!$ apiKeySet ) {
@@ -100,6 +107,12 @@ public function __construct($options) {
100107 if (!$ debuggingSet ) {
101108 $ this ->debugging = false ;
102109 }
110+ if (!$ restUrlSet ) {
111+ $ this ->base = "https://api.bitvavo.com/v2 " ;
112+ }
113+ if (!$ wsUrlSet ) {
114+ $ this ->wsurl = "wss://ws.bitvavo.com/v2/ " ;
115+ }
103116 }
104117
105118 public function newWebSocket ($ reconnect = false , $ publicCommandArray = null , $ privateCommandArray = null , $ oldSocket = null ) {
@@ -342,6 +355,7 @@ function sortAndInsert($update, $book, $sortFunc) {
342355class Websocket {
343356 public function __construct ($ bitvavo = null , $ reconnect = false , $ publicCommandArray , $ privateCommandArray , $ oldSocket ) {
344357 $ this ->parent = $ bitvavo ;
358+ $ this ->wsurl = $ bitvavo ->wsurl ;
345359 $ this ->apiKey = $ bitvavo ->apiKey ;
346360 $ this ->apiSecret = $ bitvavo ->apiSecret ;
347361 $ this ->accessWindow = $ bitvavo ->accessWindow ;
@@ -387,7 +401,7 @@ public function __construct($bitvavo = null, $reconnect = false, $publicCommandA
387401 $ reactConnector = new React \Socket \Connector ($ loop , []);
388402 $ connector = new Ratchet \Client \Connector ($ loop , $ reactConnector );
389403
390- $ connector (' wss://ws.bitvavo.com/v2/ ' )->then (function (Ratchet \Client \WebSocket $ conn ) {
404+ $ connector ($ this -> wsurl )->then (function (Ratchet \Client \WebSocket $ conn ) {
391405
392406 $ this ->reconnectTimer = 1 ;
393407 $ this ->conn = $ conn ;
0 commit comments