Trying to get MusicBox working with ssh tunnel pagekite

Hey yall - I am trying to get musicbox accessible via anywhere. I am using v 0.5.2

I am using a cool python services called pagekite:

I run a command 6680

I can see my webclient frontend now however, I get the spinning “Tryingf to reach MusicBox: Please wait” UI. I noticed that @kingosticks said this happens when trying to run via ssh port:

And recommends commenting out code in the config file. Since then the code on that config file has changed.

I’ve tried changing the default port to 80 in the /boot/config/settings.ini but this seems to have permission problems.

I’m a bit lost - could anyone suggest how to achieve what I’m aiming for:

Have musicbox available on boombox.local (as it is)
also available on (which it almost is)

Any ideas? Thanks

This is probably related to that in so far as the websocket connection to your Mopidy server is failing. The code was changed to better support using an arbitrary port but this isn’t what you are doing here. Most browsers have a console where you can view errors when loading the page, in my version of Chrome I can goto “More Tools” -> “JavaScript console” from the main menu. It might just be something to do with the websocket connection security, you probably need to use rather than

I gave it a try (using 6680 and was getting the following JS console errors when browsing to

WebSocket connection to 'ws://' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Since I wasn’t specifying a port in my browser, the webclient was trying to open a websocket connection (using the default port 6680) to But since the pagekite relays don’t listen on that port by default (maybe you can change that?) the connections were refused. If I instead go to then the websocket connection uses which is correctly relayed and then translated to localhost:6680 by pagekite running on pi musicbox.

So it turns out I was wrong - the arbitrary port support is exactly what you want!

Hey there - thanks for diving in. It seems like a really cool application that will have all sorts of uses ( @woutervanwijk may want to look into it for Pimusicbox - including the remote ssh tunnel access if needed…)

Anyways - so I also tried a few modificatiions. I changed my mopidy web port from 6680 (which is not open on pagekite) to 8000.

So here is the pagekite code to start the service:

pi@BoomBox ~ $ 8000
>>> Hello! This is v0.5.6d.                         [CTRL+C = Stop]
    Connecting to front-end ...                              
     - Protocols: http http2 http3 https websocket irc finger httpfinger raw   
     - Protocols: minecraft                                                    
     - Ports: 79 80 443 843 2222 3000 4545 5222 5223 5269 5670 6667 8000 8080  
     - Ports: 8081 9292 25565                                                  
     - Raw ports: 22 virtual                                                   
    Quota: You have 2556.81 MB, 30 days and 5 connections left.                
    Connecting to front-end ...                             
~<> Flying localhost:8000 as               < (localhost:8000)              
^C< [flying]   Kites are flying and all is well.  

And here is the error I’m now getting in my chrome browser when browsing to

WebSocket connection to 'ws://' failed: Error during WebSocket handshake: Unexpected response code: 503
mopidy.min.js:5 WebSocket error: Event {clipboardData: undefined, path: NodeList[0], cancelBubble: false, returnValue: true, srcElement: WebSocket…}bubbles: falsecancelBubble: falsecancelable: falseclipboardData: undefinedcurrentTarget: WebSocketdefaultPrevented: falseeventPhase: 0path: NodeList[0]returnValue: truesrcElement: WebSockettarget: WebSockettimeStamp: 1420371200329type: "error"__proto__: Event

Don’t want to take you too off course - but I thought I’d keep you posted on the developments…

Hmmm - when I try and run the mopidy on the local network it plays for about 30 seconds then… I eventually get this error and the music stops (using webclient).

WebSocket connection to 'ws://' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Did you try what I described in my post (with a default musicbox config)?

  1. Run 6680
  2. Goto in your web browser
1 Like

Yup - finally got around to it and it works like a charm!

Initially I got this error in my chrome browser console:

Uncaught SyntaxError: Failed to construct 'WebSocket': The URL 'ws://' is invalid.

However I changed around the commented out lines below in /opt/webclient/index.html which seemed to do the trick. It still loads locally (although I’m confused why I can’t local http://localhost when I’m ssh’d into the raspberry pi - I thought wouter had configured an iptables rule to point requests on port 80 to 6680)

  //var wsLocation = + ':6680';  //for normal operation of mopidy http
  var wsLocation =;   //for running on port 80

Anyways - I also configured the ssh tunnel so I can also ssh into my musicbox remotely :smile:

Hmmm - one strange behaviour is that when I access the ip address directly it loads as expected… however http://boombox.local gives me the following console error:

WebSocket connection to 'ws://boombox.local:6680/mopidy/ws/' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

I have found that the .local mDNS address resolving is a bit flaky - but any thoughts on why this might be?
anything todo with the webclient index.html setting?