docs: function (server_type, socket_url, connHandler, onDone) {
  
  		// handles when connection with server is established
  		var onConnect = function () {
  			
  			if (typeof connHandler === 'function')
  				connHandler('connect');
  			
  			SR.Log('websocket server connected: ' + socket_url);
  			if (typeof onDone === 'function')
  				onDone();
  		}
  		
  		// disconnect event
  		var onDisconnect = function (obj) {
  			if (typeof connHandler === 'function')
  				connHandler('disconnect');
  			
  			SR.Warn('disconnected... obj: ');
  			SR.Warn(obj);
  			
  			// attempt to re-connect
  			if (typeof conn_options === 'object') {
  				removeEntry(currentEntry);
  				currentEntry = undefined;
  				SR.Warn('re-connecting websocket with options');
  				SR.Warn(conn_options);
  				SR.setSocketServer(conn_options);
  			}
  		}
  		
  		// configure priority of protocol used
  		//io.configure(function () { 
  			//io.set("transports", ["xhr-polling", "flashsocket", "json-polling"]); 
  		//});
  				
  		// connect to server
  		SR.Log('connecting to server: ' + socket_url);
              
  		if (server_type === 'socketio') {
              
  			socket = io.connect(
  				socket_url
  				/*
  				{	
  					'reconnection delay': 10000,
  					'reconnection limit': 4,
       	 			'max reconnection attempts': 4
  				}
  				*/
  			);
  			
  			var generateHandler = function (name) {
  				return function () {
  					if (typeof connHandler === 'function')
  						connHandler(name);
  				}
  			}
  			
  			// Return socket connection status and response
  			for (var i=0; i < socketEvents.length; i++) {
  				var event_name = socketEvents[i];
  				socket.on(event_name, generateHandler(event_name));
  			}
  			
              // connection success
              socket.on('connect', onConnect);
  			socket.on('disconnect', onDisconnect);
  			
  			// move this outside of 'connect' event handling (to avoid duplicates)
  			socket.on('SRR', function (data) {
  				SR.Log('SRR received, type: ' + data[HEADER_UPDATE]);
  				onResponse(data[HEADER_UPDATE], data[HEADER_PARA]);
  			});
              
              // attach customized send function
              socket.sendJSON = function (obj) {
                  socket.emit('SR', obj);
              }
  		}
  		else if (server_type === 'sockjs') {
  			socket = {};
  			var url = socket_url + '/sockjs';
  			SR.Log('sockjs URL to connect: ' + url);
  
              // Create a connection to server
              var sock = new SockJS(url);
      
              // Open the connection
  			sock.onopen = function () {
  				socket.opened = true;
  				// send cookie explicitly
  				SR.Warn('sockjs sending cookie:');
  				SR.Warn(document.cookie);
  				sock.send(document.cookie);
  				onConnect();
  			}
  			
              // On connection close
              sock.onclose = onDisconnect;
  
              // On receive message from server
              sock.onmessage = function (e) {
                  // Get the content
                  var obj = JSON.parse(e.data);
  				onResponse(obj[HEADER_UPDATE], obj[HEADER_PARA]);
              }
              
              // attach customized send function
  			
  			socket.sendJSON = function (obj) {
  								sock.send(JSON.stringify(obj));
              				};
  		}
  		else  {
  			SR.Error('unrecongizable server_type: ' + server_type + ' please check if socket.io or sockjs is used');	
  		}
  	}