engineering

engineering

Bistri Button : one-click WebRTC Video Calling

Bistri Team April 29, 2013 engineering No comments

Customize your own Bistri click-to-call button, then paste it anywhere!

From now on, if you decide so, anybody can know your presence even before to click on the button, then make a video call, send a chat message, and some files, up to 100Mb each, without any registration nor account to create.

image

You can customize the size, display or not if you are online on Bistri, customize the label of the button. This is how it looks like :

image

and then… wait for the calls 🙂

Thank God It’s Friday 🙂

Amazon S3 lifecycle configuration

Bistri Team May 16, 2012 engineering, tip

Amazon S3 provides a great option to handle the ttl (time to live) of your files. Indeed you can set a lifecycle configuration to your bucket.

But the implementation of this part of the API is not very common around the open source projects that give access to S3. 

Because we needed it inside a Node.js module, we forked a github project called aws2js, and gave it support for lifecycle configuration.

See the pull request

Don’t hesitate to test it and bring us feedback!

Socket.io + HaProxy + HTTP Authentication

Bistri Team December 16, 2011 engineering

We wanted to add an authentication step before accessing static and socket.io served by node.js. But stock port redirections do not work.

Because websockets breaks HTTP 1.1 protocol, Nginx was unable to complete the task. So we used HAProxy with his tcp mode and a small test to identify and redirect websocket connections.

# /etc/haproxy/haproxy.cfg (snippet)
# ACL & Auth for connect and socket.io front end
userlist UsersAuth
  group admin users admin
  user admin insecure-password mypassword
# Setup the listenning port 
frontend all 0.0.0.0:80
    timeout client 86400000
    default_backend www_papou
    acl is_websocket hdr(Upgrade) -i WebSocket
    use_backend socket_backend if is_websocket
# web partbackendbackend www_papou
    balance roundrobin
    option      forwardfor # This sets X-Forwarded-For
    option    httplog             
    timeout server 30000
    timeout connect 40000

    # restrict to authenticated users
    acl AuthOkay_Web http_auth(UsersAuth)
    http-request auth realm AuthYourself if !AuthOkay_Web    # forward to the real server
    server server1 localhost:8000 weight 1 maxconn 1024 check
# socket.io part
backend socket_backend
    balance roundrobin
    option tcplog
    timeout queue 5000
    timeout server 86400000
    timeout connect 86400000
    server socket localhost:8000 weight 1 maxconn 1024 check
#end config

With this setup, incomming connections on port 80 are proxy-ied to port 8000 on the node.js app and anonymous access is prohibited and delegated to the proxy.

So far, it works well using websocket transport. Indeed firewalling must be set up to prevent direct connections to port 8000.

Versions used : nodejs 0.4.10, haproxy 1.4.8 , socket.io 0.8.7