Update encoding.py

Open and update messages are now valid JSON messages.
Update messages contains now the 'type' element.
Update encoding.py

Since it is now a function, we must call it.
Merge pull request #5 from wmiltenburg/master

Added type element in update (JSON) message