Can't connect photon to local server

I’m trying to connect my Photon to a local server on my Respberry Pi and I’m getting a “CryptoStream transform error”. I’ve seen other discussion regarding this problem, and I see on Github a “commit” that fixes the problem apparently posted yesterday.

CryptoStream error fix

So I am very new to all of this. I’ve never run a local server before. I’m not sure what a “commit” is. I’ve tried running npm update in the spark-server directory and I still get the error. I’m not sure where to go from here.

How can I implement this fix?

Do you have git installed?

Yes, I do. Should I use git clone to redownload spark-server files and run npm-install again?

Use this:

  • git clone https://github.com/straccio/spark-protocol
  • replace this inside the node_modules of spark-server

Nope, had to go in manually and edit CrytoStream.js to match the “commit”. Phew! Finally connected!!! Took me days of reading through various tutorials and learning way more about Linux than I wanted to know in order to make it happen. I really hope you guys make streamlining local server installation a priority for us not so sophisticated folks.

For anyone who happens to stumble across this and is looking for help getting a local server running on a raspberry pi, here’s a script I wrote to make it happen. Sprinkle sudo reboot liberally throughout.

Setup Script:

Load Raspbian Jesse

sudo apt-get update
sudo apt-get upgrade
sudo apt-get build-dep dfu-util
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install npm
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'

Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH

source ~/.profile
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
npm install -g particle-cli
nano /etc/dhcpcd.conf

Add:
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

wget http://dfu-util.gnumonks.org/releases/dfu-util-0.7.tar.gz
tar xvf dfu-util-0.7.tar.gz
cd dfu-util-0.7
./configure
make
sudo make install
cd
git clone https://github.com/spark/spark-server.git
cd spark-server
npm install
node main.js

That will at least get the server running.