Rapid development & integration of real time communication in websites

19
Rapid Development & Integration of Real Time Communication in Websites PyCon Kiwi’13 Chetan Giridhar

description

Real time communications in websites

Transcript of Rapid development & integration of real time communication in websites

Page 1: Rapid development & integration of real time communication in websites

Rapid Development & Integration of Real Time Communication in Websites

PyCon Kiwi’13

Chetan Giridhar

Page 2: Rapid development & integration of real time communication in websites

Facts

Website developers focus

Core functionality, Design

User Interface, Performance

Statistics

About 38% customers agree that they made their deals from the website due to engagement itself

56% of the people prefer live engagement over email or social media as preferred communication method

Could we make websites better? Can Python help?

Page 4: Rapid development & integration of real time communication in websites

Development Considerations

Asynchronous

Real time exchange

Full duplex communication

Store chat information

Easy to use APIs – think reuse

Free and Open Source

Page 5: Rapid development & integration of real time communication in websites

Pure Python

ws4py – python client library for web sockets

tornado.websocket.WebSocketHandler

class Socket(tornado.websocket.WebSocketHandler):def on_message(self, message):

self.write_message(“Msg is” + message)

from ws4py.client.threadedclient import WebSocketCientclass Client(WebSocketClient)

def opened(self): self.send(“Hello”)def received_message(self, message):

print “From server:” + message

open() on_close()

closed()

Page 6: Rapid development & integration of real time communication in websites

Framework

Tornado Web Server

End User

asyncmongo/redis

Web Sockets / Ajax

Store Chat Messages

Analyze and generate patterns

feedback

HTML/CSS

Page 7: Rapid development & integration of real time communication in websites

Live Chat –Ajax

function newMessage(form) {$.postJSON("/a/message/new", message, function(response) {

updater.showMessage(response);});

}

class MessageNewHandler:def post(self):

message = {"id": str(uuid.uuid4()),"from": self.current_user["first_name"],"body": self.get_argument("body"),

}message["html"] = self.render_string

("message.html", message=message)

Page 8: Rapid development & integration of real time communication in websites

Live Chat - Websockets

var url = "ws://" + location.host + "/chatsocket";updater.socket = new WebSocket(url);function newMessage(form) {updater.socket.send(JSON.stringify(message));}

class ChatSocketHandler:def on_message(self, message):

chat = {"id": str(uuid.uuid4()),"body": parsed["body"],}

chat["html"] = self.render_string("message.html", message=chat)

Page 10: Rapid development & integration of real time communication in websites

Development

Considerations:

Ease of use

Availability of service

Point to point

Tools

Web Server: Tornado

JavaScript: webrtc

Page 11: Rapid development & integration of real time communication in websites

What it means to Business?

Better Marketing demonstrations

Increased Product up sales

Improved Customer Satisfaction Score

Convert customer pain points to profits

Competitive Edge

Reduced Expenses – customer support time/telephone

Did someone say more revenue?

Page 12: Rapid development & integration of real time communication in websites

How can developers help?

Commercially available

Used off the shelf? – Often not

Data in the desired format?

To analyze and identify patterns

Looks like I can develop it myself??!

When are you building yours?

Page 13: Rapid development & integration of real time communication in websites

References

Market research: Forrester Research and Boldchat

Demos hosted on http://heroku.com

eAssistance Pro video on youtube.com

webrtc-plugin http://freshtilledsoil.com/

Free website templates from http://WebsiteTemplatesOnline.com

Tornado web server http://tornadoweb.org

MongoDB www.mongodb.org

Page 14: Rapid development & integration of real time communication in websites

Questions?

Source Code

https://github.com/cjgiridhar

Blog

http://technobeans.com

Contact

[email protected]

Page 15: Rapid development & integration of real time communication in websites

Live chat demo - Tourism

Chat Window

Page 16: Rapid development & integration of real time communication in websites

Demo…

User login with gmail(openid)

Cross selling with

Chat

Page 17: Rapid development & integration of real time communication in websites

Video Chat – Interior Design

Page 18: Rapid development & integration of real time communication in websites
Page 19: Rapid development & integration of real time communication in websites