Skip to content

Instantly share code, notes, and snippets.

View manuel-rubio's full-sized avatar
👋
Say Hi! and let me know if you want to contribute!

Manuel Rubio manuel-rubio

👋
Say Hi! and let me know if you want to contribute!
View GitHub Profile
@manuel-rubio
manuel-rubio / README.md
Last active February 1, 2016 03:02
IM Binary & SSL protocol think for use with mobile platforms. This protocol has special approach on small & slow data transfers and security.

IM Binary & SSL secured

All the time I was working with XMPP I realized this protocol has a lot of flaws to use in mobile devices, even the lack of sync for the messages between several devices. This protocol tries to solve those flaws:

  1. Use of bandwidth. This protocol is binary and use keywords to save a lof of bandwidth using the same protocol and the same featureas as XMPP.
  2. Reliability of the messages. Using ACKs in every sent ensure all of the messages will arrive to the destin and in the same order. The protocol is async, but for messages the server must to use a pipeline sent.
  3. Multi-device. Capabilities to ensure the messages are delivered on all the devices the user has registered.
  4. Security. Ensuring a certificate is valid between client and server (client must to check server certificate and server must to check client certificate) ensure the communication should be more secure.

REGISTER, AUTH & SESSIONS

Testing ephp

To test how can works ephp I do a escriptize and you can use it to execute simple php code:

git clone https://github.com/bragful/ephp
cd ephp
make
#!/usr/bin/env escript
epoch() ->
{Mega,Sec,Mili} = now(),
(Mega * 1000000) + Sec + (Mili / 1000000).
measure(F) ->
Ini = epoch(),
F(),
epoch() - Ini.
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 'text to encode'"
exit 0
fi
echo "$1" | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg'
echo