How to convert terminal window chat application (built using socket programming, written in python) into a web application? -


so, wrote chat application works in terminal windows: github source

now want convert web chat application friends can connect/chat/test network. but, clueless how proceed!

please me. suggest me technologies can use make available on website?

it looks you've written python server handle python chat clients, , you'd extend web clients.

i recommend using real-time network such pubnub relay data between chat clients , server. using real-time network means can spend less time worrying low-level socket issues such concurrency , more time building application.

in case of pubnub, python sdk allow server subscribe chat channels, while javascript sdk web-based clients. can build simple javascript-based web client using code in blog post: build real-time chat apps in 10 lines of code.

enter chat , press enter <div><input id=input placeholder=you-chat-here /></div>  chat output <div id=box></div>  <script src=http://cdn.pubnub.com/pubnub.min.js></script> <script>(function(){   var box = pubnub.$('box'), input = pubnub.$('input'), channel = 'chat';   pubnub.subscribe({     channel : channel,     callback : function(text) { box.innerhtml = (''+text).replace( /[<>]/g, '' ) + '<br>' + box.innerhtml }   });   pubnub.bind( 'keyup', input, function(e) {     (e.keycode || e.charcode) === 13 && pubnub.publish({       channel : channel, message : input.value, x : (input.value='')     })   } ) })()</script> 

then, on python server, subscribe same chat channel:

# listen messages *blocking* def receive(message) :   broadcast_data(message) #this using python function github link   return true  pubnub.subscribe({   'channel'  : 'chat',   'callback' : receive  }) 

let me know if works you. luck!


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -