Skip to main content

Posts

Showing posts from May, 2014

HTML5 WebSocket vs Long Polling vs AJAX vs WebRTC

Web socket  - Ajax - long poll WebSockets - is definitely the future. Long polling is dirty workaround of preventing creating connections for each request like AJAX does. But long polling was created when WebSockets didn't existed. Now due WebSockets, Long Polling is going away. Here is a chart  of Browsers that supports WebSockets right now. Comparison of different communication techniques: AJAX  - create connection to server on each request, sends request (with possible extra data as like request methods GET, POST, PUT, DELETE, .. , and arguments in url), and gets response from server. Then connection closes. It is single request > response for each AJAX call. Long poll  - creates connection to server like AJAX does, but keep-alive connection open for some time (not long though), during connection open client can receive data from server. Client have to reconnect periodically after connection is closed due to timeouts. On server side it still tre...

EXTJS Best Practices

ExtJS is a powerful Javascript framework for developing rich Internet applications—but with great power comes great responsibility. If you are inexperienced or careless with your implementation, your development effort can quickly spin out of control. Your project structure might grow to become unruly, steepening the learning curve for developers new to the framework. Worse yet, performance issues may arise that can be tricky to deal with once they have a foothold within your application. Equipped with some tips from Senchacon ‘13 and my past experience with ExtJS, I’d like to share some knowledge that will help you be proactive against these issues and avoid potential roadblocks. Folder and Code Structure First, two pieces of advice that are not specific to ExtJS, but still helpful: Maintain an organized project structure.  Placing every view under “views” in a directory is likely to cause headaches somewhere down the line, especially if a developer unfamil...

JSLINT Syntax

JSLINT standards: if(value != null){ Use '!==' to compare with 'null'. if(name.dataIndex !='' || name.dataIndex != null){ Use '!==' to compare with ''. if(rowIndex == 0){ Use '===' to compare with '0'. data.push({description: obj['city'], required: true}); ['city'] is better written in dot notation. data.push({description: obj.city, required: true});  //dot notation as per jslint syntax var obj = new Object(); Use the object literal notation {}. //wrong var x = {         prop: 10     },     y = x["prop"]; //correct var x = {         prop: 10     },     y = x.prop;