How to construct a WebSocket URI relative to the page URI? - websocket

I want to construct a WebSocket URI relative to the page URI at the browser side. Say, in my case convert HTTP URIs like
http://example.com:8000/path
https://example.com:8000/path
to
ws://example.com:8000/path/to/ws
wss://example.com:8000/path/to/ws
What I'm doing currently is replace the first 4 letters "http" by "ws", and append "/to/ws" to it. Is there any better way for that?

If your Web server has support for WebSockets (or a WebSocket handler module) then you can use the same host and port and just change the scheme like you are showing. There are many options for running a Web server and Websocket server/module together.
I would suggest that you look at the individual pieces of the window.location global and join them back together instead of doing blind string substitution.
var loc = window.location, new_uri;
if (loc.protocol === "https:") {
new_uri = "wss:";
} else {
new_uri = "ws:";
}
new_uri += "//" + loc.host;
new_uri += loc.pathname + "/to/ws";
Note that some web servers (i.e. Jetty based ones) currently use the path (rather than the upgrade header) to determine whether a specific request should be passed on to the WebSocket handler. So you may be limited in whether you can transform the path in the way you want.

Here is my version which adds the tcp port in case it's not 80 or 443:
function url(s) {
var l = window.location;
return ((l.protocol === "https:") ? "wss://" : "ws://") + l.hostname + (((l.port != 80) && (l.port != 443)) ? ":" + l.port : "") + l.pathname + s;
}
Edit 1: Improved version as by suggestion of #kanaka :
function url(s) {
var l = window.location;
return ((l.protocol === "https:") ? "wss://" : "ws://") + l.host + l.pathname + s;
}
Edit 2: Nowadays I create the WebSocket this:
var s = new WebSocket(((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + "/ws");

Using the Window.URL API - https://developer.mozilla.org/en-US/docs/Web/API/Window/URL
Works with http(s), ports etc.
var url = new URL('/path/to/websocket', window.location.href);
url.protocol = url.protocol.replace('http', 'ws');
url.href // => ws://www.example.com:9999/path/to/websocket

Assuming your WebSocket server is listening on the same port as from which the page is being requested, I would suggest:
function createWebSocket(path) {
var protocolPrefix = (window.location.protocol === 'https:') ? 'wss:' : 'ws:';
return new WebSocket(protocolPrefix + '//' + location.host + path);
}
Then, for your case, call it as follows:
var socket = createWebSocket(location.pathname + '/to/ws');

easy:
location.href.replace(/^http/, 'ws') + '/to/ws'
// or if you hate regexp:
location.href.replace('http://', 'ws://').replace('https://', 'wss://') + '/to/ws'

On localhost you should consider context path.
function wsURL(path) {
var protocol = (location.protocol === 'https:') ? 'wss://' : 'ws://';
var url = protocol + location.host;
if(location.hostname === 'localhost') {
url += '/' + location.pathname.split('/')[1]; // add context path
}
return url + path;
}

In typescript:
export class WebsocketUtils {
public static websocketUrlByPath(path) {
return this.websocketProtocolByLocation() +
window.location.hostname +
this.websocketPortWithColonByLocation() +
window.location.pathname +
path;
}
private static websocketProtocolByLocation() {
return window.location.protocol === "https:" ? "wss://" : "ws://";
}
private static websocketPortWithColonByLocation() {
const defaultPort = window.location.protocol === "https:" ? "443" : "80";
if (window.location.port !== defaultPort) {
return ":" + window.location.port;
} else {
return "";
}
}
}
Usage:
alert(WebsocketUtils.websocketUrlByPath("/websocket"));

I agree with #Eadz, something like this is cleaner and safer:
const url = new URL('./ws', location.href);
url.protocol = url.protocol.replace('http', 'ws');
const webSocket = new WebSocket(url);
The URL class saves work and deals with things like query parameters, etc.

Dead easy solution, ws and port, tested:
var ws = new WebSocket("ws://" + window.location.host + ":6666");
ws.onopen = function() { ws.send( .. etc

Related

Ajax request fails in JBOSS EAP 7.1 in Java EAR application

I've EAR applications which run fine in JBOSS EAP 6.3. When I run this application in EAP 7, then ajax call response is empty after few call. Mainly jsp page calls servlet using ajax. I use common code snippet for AJAX call. I can get response properly first 3/4 times. After that it is not working. The whole thing is working fine in EAP 6.3.
The ajax code snippet is as follows:
try{
objXMLHTTP = new XMLHttpRequest();
}catch(e){
try {
objXMLHTTP = new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
catch(e){
try {
objXMLHTTP = new ActiveXObject("MSXML2.XMLHTTP");
}
catch(e) {
try {
objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e) {
alert("XMLHTTP Not Supported On Your Browser");
return;
}
}
}
}
var urlstr = "" ;
var key = "";
var j = 0;
//dataStore is an array of key/value pair.
for(key in dataStore){
if(j == 0) {
urlstr += key + "=" + dataStore[key];
j = 1;
} else {
urlstr += "&" + key + "=" + dataStore[key];
}
}
var _dateTime = new Date().getTime();
urlstr += "&CALLTIME=" + _dateTime + "-";
var requNumber = "?requNumber=" + _dateTime;
// http request has been changed as Parameterised
var _AsyncRequest = true;
try{
if(_httpMode == "undefined")
_httpMode = "0";
}catch(e){
_httpMode = "0";
}
if((_httpMode != "undefined") && (_httpMode != null) && (_httpMode == "1"))
{
_AsyncRequest = false;
}
if(!document.all)
{
_AsyncRequest = false;
}
if(urlstr.length<=1000) {
objXMLHTTP.open("POST","XMLDHTTPServlet" + requNumber + "&" + urlstr,false);
} else {
objXMLHTTP.open("POST","XMLDHTTPServlet" + requNumber,false);
}
urlstr = URLEncode(urlstr);
objXMLHTTP.setRequestHeader("content-type", "application/x-www-form-urlencoded") ;
//The following is not working after few calls
if(urlstr.length<=1000) {
objXMLHTTP.send("");
} else {
objXMLHTTP.send(urlstr);
}
rtnXML = objXMLHTTP.responseText;
if (objXMLHTTP.statusText == "OK" )
// This condition fails after successive requests
{
//Code
}
Following is in JSP page to call the AJAX. Most importantly, when I put the character **|**, then response in empty and objXMLHTTP.statusText shows Bad Request in EAP 7. But EAP 6, it is working fine.
var objXMLApplet = new xmlHTTPValidator();
objXMLApplet.clearMap();
objXMLApplet.setValue("Package", "panaceaFLweb.getMenuInfo.ReadInfo");
objXMLApplet.setValue("ValidateToken","true");
objXMLApplet.setValue("Method", "chkEODStatus");
objXMLApplet.setValue("BRNCH_CODE",BranCode);
objXMLApplet.setValue("CURR_BUSS_DATE",CBD);
objXMLApplet.setValue("DataTypes","S|S");
objXMLApplet.sendAndReceive();
It is because character | present in URL post request and didn't encode the string which length is less than 1000. Just use
urlstr = URLEncode(urlstr);
before if/else condition of connection open.
Code snippet are as follows:
urlstr = URLEncode(urlstr);
if(urlstr.length<=1000) {
objXMLHTTP.open("POST","XMLDHTTPServlet" + requNumber + "&" + urlstr,false);
} else {
objXMLHTTP.open("POST","XMLDHTTPServlet" + requNumber,false);
}
objXMLHTTP.setRequestHeader("content-type", "application/x-www-form-urlencoded") ;
if(urlstr.length<=1000) {
objXMLHTTP.send("");
} else {
objXMLHTTP.send(urlstr);
}
rtnXML = objXMLHTTP.responseText;
And URLEncode function definition are as follows:
function URLEncode(urlstr ){
var SAFECHARS = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "-_.!~*'()=?&";
var HEX = "0123456789ABCDEF";
var plaintext = urlstr;
var encoded = "";
for (var i = 0; i < plaintext.length; i++ ) {
var ch = plaintext.charAt(i);
if (ch == " "){
encoded += "+";
}else if (SAFECHARS.indexOf(ch) != -1) {
encoded += ch;
}else {
var charCode = ch.charCodeAt(0);
if (charCode > 255) {
encoded += "+";
}else {
encoded += "%";
encoded += HEX.charAt((charCode >> 4) & 0xF);
encoded += HEX.charAt(charCode & 0xF);
}
}
}
return encoded;
}

Host.updateLicenseRequestInfo not able to add headers

Hi I am trying to achieve any one of the below
1) Set a extra token to the license url by the code ' requestInfo.url = requestInfo.url + "#12345678";'
OR
2) Set headers by the code 'requestInfo.headers = new String('token:12345678\r\n');'
But nothing seems to work.
After updating the url in receiver logs i see 'Updated requestInfo.url ' with the extra '#12345678' at the end of the license url. But on license server I get only the url which is unmodified ( no #12345678).
Same with requestInfo.headers. I don't see any headers which I set in receiver app when the request comes in license server.
I also tried returning the requestInfo; but with this the chromecast is not able to play anything. So I commented the return statement.
Would appreciate any pointers to fix this issue. Here is my code.
var host = new cast.player.api.Host({
'url': url,
'mediaElement': this.mediaElement_
});
host.onManifestReady = function() {
self.log_('prototype.loadVideo_::My onManifestReady');
};
host.updateLicenseRequestInfo = function(requestInfo){
self.log_('prototype.loadVideo_::updateLicenseRequestInfo()');
self.log_('requestInfo.url ' + requestInfo.url);
self.log_('requestInfo.headers ' + requestInfo.headers);
self.log_('requestInfo.protectionSystem ' + requestInfo.protectionSystem);
self.log_('requestInfo.setResponse ' + requestInfo.setResponse);
self.log_('requestInfo.skipRequest ' + requestInfo.skipRequest);
self.log_('requestInfo.timeoutInterval ' + requestInfo.timeoutInterval);
self.log_('requestInfo.withCredentials ' + requestInfo.withCredentials );
requestInfo.url = requestInfo.url + "#12345678";
//host.licenseUrl = requestInfo.url;
//requestInfo.headers = new String('token:12345678\r\n');
self.log_('Updated requestInfo.url ' + requestInfo.url);
self.log_('Updated requestInfo.headers ' + requestInfo.headers);
//return requestInfo;
};
this.player_ = new cast.player.api.Player(host);
updateLicenseRequestInfo - enables the host to customize request information used to get media license from the server. Applications should override this method to add a token to the url, set headers or withCredentials flag.
Here is the example code on how to use it.
host.updateManifestRequestInfo = function(requestInfo) {
if (!requestInfo.url) {
requestInfo.url = this.url;
}
requestInfo.withCredentials = true;
};
host.updateLicenseRequestInfo = function(requestInfo) {
requestInfo.withCredentials = true;
};
host.updateSegmentRequestInfo = function(requestInfo) {
requestInfo.withCredentials = true;
};
You can also visit this page for more information.

AD with LDAP connection error

Im trying to use a .net application but the application cant find the server in my local network.
Im using LdapExploreTool 2 with the following settings:
the base DN is "DC=exago,DC=local", the Ip address "192.168.1.250" and the server name "exago.local"
The connection is successful and this is the result:
Inputing the values:
Examining the code, i get the exception when "Bind to the native AdsObject to force authentication":
"The specified domain either does not exist or could not be contacted."
public bool IsAuthenticated(string domain, string ldapPath, string username, string pwd, string userToValidate)
{
string domainAndUsername = domain + #"\" + username;
if (string.IsNullOrEmpty(ldapPath))
SetLdapPath(domain);
else
_path = ldapPath;
App.Services.Log.LogUtils.WriteLog(Log.LogLevel.INFO, "IsAuthenticated_DirectoryEntry:" + _path + "," + domainAndUsername + "," + pwd);
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
//check if domain is valid
int domainId = AppDomains.GetDomainIdByName(domain);
if (domainId == int.MinValue)
{
return false;
}
AppDomains d = AppDomains.GetRecord(domainId);
List<AppDomainQueries> lQueries = new List<AppDomainQueries>(AppDomainQueries.GetArray());
lQueries = lQueries.FindAll(delegate(AppDomainQueries dq) { return dq.DomainId == domainId && dq.Status == 'A'; });
string queryString = string.Empty;
try
{
// Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
string ldapAndQuerie = string.Empty;
//base account search
queryString = "(SAMAccountName=" + userToValidate + ")";
if (username != userToValidate)
{
if (lQueries.Count == 1)
ldapAndQuerie = lQueries.FirstOrDefault().QueryString;
if ((ldapAndQuerie != string.Empty) && (ldapAndQuerie != "*") && (ldapAndQuerie != "(objectClass = user)"))
queryString = "(&(SAMAccountName=" + userToValidate + ")" + ldapAndQuerie + ")";
}
search.Filter = queryString;
App.Services.Log.LogUtils.WriteLog(Log.LogLevel.INFO, "LDAP=" + queryString);
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
// Update the new path to the user in the directory
_path = result.Path;
_filterAttribute = (String)result.Properties["cn"][0];
}
catch (Exception ex)
{
App.Services.Log.LogUtils.WriteLog(Log.LogLevel.ERROR, "App.Services.Core.LdapAuthentication.IsAuthenticated() Exception - (LDAP=" + queryString + ")" + ex.Message, ex);
return false;
}
return true;
}
How can i establish a connection?
The problem was the LDAP connection string,
it seems that it missed the actual location(IP + port) in the network.
LDAP://192.168.1.250:389/DC=exago,DC=local

API to create cookie for FireFox

I want to write an application which will create cookies for firefox.
I want to create Client cookies so that firefox will send cookie content in HTTP request.
Similar to the win32 API InternetSetCookie()
Can you please guide on this ?
If you can point me to some code snippet or help, I will try to figure out from that.
This cookie needs to go to SQLITE database, but it seems from old questions that this database get locked if firefox is running. This locking is done in FF 3.5
Just want to confirm if this is the case with FF9 or do we have any API ?
Regards
On Firefox, you can write an add-on to achieve that. Take a look at the source code of the following add-ons. They provide features such as adding, deleting, editing cookies while Firefox is running. It seems they all work with Firefox 9.0.1 (latest stable).
Cookie Manager+
Advanced Cookie Manager
Add N Edit Cookie
Edit Cookie
Edit:
I am posting some cookie management code from the Evernote plugin's MozillaCookieManagerImpl.js file. I think the code speaks for itself. Have a look below. It shows how to access cookies, set, get and remove them etc.
Accessing Mozilla's Cookie Management Interface
Evernote.MozillaCookieManagerImpl = function MozillaCookieManagerImpl() {
};
Evernote.inherit(Evernote.MozillaCookieManagerImpl,
Evernote.CookieManagerImpl, true);
Evernote.MozillaCookieManagerImpl.isResponsibleFor = function(navigator) {
var ua = navigator.userAgent.toLowerCase();
return (ua.indexOf("firefox") >= 0 || ua.indexOf("thunderbird") >= 0 || ua
.indexOf("shredder") >= 0);
};
Evernote.MozillaCookieManagerImpl.prototype.manager = null;
Evernote.MozillaCookieManagerImpl.prototype._ios = null;
Evernote.MozillaCookieManagerImpl.prototype._cookieSrv = null;
Evernote.MozillaCookieManagerImpl.prototype._cookieManagerSrv = null;
Evernote.MozillaCookieManagerImpl.prototype.getIOService = function() {
if (this._ios == null) {
this._ios = Components.classes["#mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
}
return this._ios;
};
Evernote.MozillaCookieManagerImpl.prototype.getCookieService = function(
force) {
if (this._cookieSrv == null || force) {
this._cookieSrv = Components.classes["#mozilla.org/cookieService;1"]
.getService(Components.interfaces.nsICookieService);
}
return this._cookieSrv;
};
Evernote.MozillaCookieManagerImpl.prototype.getCookieManagerService = function(
force) {
if (this._cookieManagerSrv == null || force) {
this._cookieManagerSrv = Components.classes["#mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager);
}
return this._cookieManagerSrv;
};
Get Cookie
Evernote.MozillaCookieManagerImpl.prototype.get = function(name, url) {
var uri = this.getIOService().newURI(url, null, null);
var cookieMgr = this.getCookieManagerService();
if (cookieMgr) {
for ( var e = cookieMgr.enumerator; e.hasMoreElements();) {
var cookie = e.getNext().QueryInterface(Components.interfaces.nsICookie);
if (cookie && cookie.host == uri.host && cookie.name == name) {
return new Evernote.Cookie(cookie);
}
}
}
return null;
};
Set Cookie
Evernote.MozillaCookieManagerImpl.prototype.set = function(cookie, url) {
var uri = (typeof url == 'string') ? this.getIOService().newURI(url, null,
null) : null;
if (cookie instanceof Evernote.Cookie && typeof cookie.name == 'string'
&& cookie.name.length > 0) {
this.getCookieService().setCookieString(uri, null,
(cookie.name + "=" + cookie.value + ";"), null);
}
};
Removie Cookie
Evernote.MozillaCookieManagerImpl.prototype.remove = function(name, url) {
var cookieMgr = this.getCookieManagerService();
var urlParts = url.split("://", 2);
var domain = (urlParts.length == 2) ? urlParts[1] : urlParts[0];
urlParts = domain.split("/", 2);
var path = (urlParts.length == 2) ? urlParts[1] : null;
cookieMgr.remove(domain, name, path, false);
};

Inconsistent data corruption in a store loaded through a proxy reader

We're experiencing inconsistent data corruption in a store loaded through a proxy reader.
It's browser dependant.
Works fine in Chrome and Safari on the desktop all the time.
On our two testing iPhones it intermittently breaks depending on the data the store has loaded, larger data volume seems to cause more breaks. We can't see any errors or patterns in the JSON data where it breaks.
Symptoms:
data loads, but some of the data belonging to the last few items is missing
a read listener attached to the store doesn't fire when this data loss occurs, it does fire on the desktop browser where we experience not data loss
The piece of data that always seems to be lost is the start_time.
We've been trying to debug this one for a while now and are really stumped.
Thank you for any ideas you might have as to why this is occurring.
Our regModel
Ext.regModel('Booking', {
fields: ['id', 'start', 'end', 'title', 'service', 'service_id', 'client_note', 'stylist_note', 'utc_start','day_date', 'start_time', 'end_time', "home_ph", "mobile_ph", 'work_ph', 'work_ext', 'email', 'utc_end']
});
Our store
var store = new Ext.data.JsonStore({
model : 'Booking',
sorters: 'utc_start',
autoLoad: false,
proxy: {
type: 'ajax',
url: '../includes/get_appointments.php',
extraParams: {
req_start: '1295251200',
req_end: '1295856000'
},
reader: {
type: 'json',
root: 'events'
}
},
listeners: {
load:function(store, records, success) {
bookings.setLoading(false);
// check to see length of records, start i from there
for (var i = 0; i < records.length; i++){
utc_start = records[i].get('utc_start');
utc_end = records[i].get('utc_end');
// create day of week
// y,m,d
// time
var this_start_date = new Date((utc_start * 1000));
var this_end_date = new Date((utc_end * 1000));
var day_of_week = days_of_week[this_start_date.getDay()];
var date_of_month = this_start_date.getDate();
var month_of_year = month_names[this_start_date.getMonth()];
var full_year = this_start_date.getFullYear();
var start_military_hours = this_start_date.getHours();
var this_start_minutes = this_start_date.getMinutes();
var end_military_hours = this_end_date.getHours();
var this_end_minutes = this_end_date.getMinutes();
if(this_start_minutes == "0")
{
this_start_minutes = "00";
}
if(parseInt(start_military_hours) < 12)
{
var start_time = start_military_hours + ":" + this_start_minutes + " AM";
}
else if(parseInt(start_military_hours) == 12)
{
var start_time = start_military_hours + ":" + this_start_minutes + " PM";
}
else
{
var start_time = (parseInt(start_military_hours) - 12) + ":" + this_start_minutes + " PM";
}
if(this_end_minutes == "0")
{
this_end_minutes = "00";
}
if(parseInt(end_military_hours) < 12)
{
var end_time = end_military_hours + ":" + this_end_minutes + " AM";
}
else if(parseInt(end_military_hours) == 12)
{
var end_time = end_military_hours + ":" + this_end_minutes + " PM";
}
else
{
var end_time = (parseInt(end_military_hours) - 12) + ":" + this_end_minutes + " PM";
}
var day_date = day_of_week + ", " + full_year + " " + month_of_year + " " + date_of_month;
if(records[i].get('service_id') == 0)
{
records[i].set('title', 'Booked off');
records[i].set('service', '');
}
records[i].set('day_date', day_date);
records[i].set('start_time', start_time);
records[i].set('end_time', end_time);
}
if(store.proxy.reader.rawData.next_page_num == undefined)
{
store.start = store.proxy.reader.rawData.prev_page_num;
}
else
{
store.currentPage = store.proxy.reader.rawData.next_page_num;
}
}, read:function(store,records,success){
Ext.Msg.alert('data read');
}
},
getGroupString : function(record) {
return record.get('day_date'); // optional char from array removed
}
});
Our JSON
{"events":[{"id":"3739","start":"2011-01-18T10:00:00-08:00","end":"2011-01-18T11:45:00-08:00","title":"Jen Cannor","service":"Haircut & Highlights","service_id":"67","client_note":"","stylist_note":"Looking forward to seeing Jen when she comes in next.","utc_start":"1295373600","email":"jen.c#cannorfarms.net","home_ph":"232-433-2222","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295379900"},{"id":"3740","start":"2011-01-18T12:00:00-08:00","end":"2011-01-18T13:30:00-08:00","title":"Michelle Steves","service":"Root Colour","service_id":"69","client_note":"","stylist_note":"","utc_start":"1295380800","email":"michelle5b64#telus.net","home_ph":"604-555-5555","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295386200"},{"id":"3741","start":"2011-01-18T13:30:00-08:00","end":"2011-01-18T14:00:00-08:00","title":"Amanda Brenner","service":"Wash & blow dry","service_id":"70","client_note":"","stylist_note":"","utc_start":"1295386200","email":"amandab#coastfitness.com","home_ph":"555-235-2366","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295388000"},{"id":"3742","start":"2011-01-18T14:00:00-08:00","end":"2011-01-18T15:45:00-08:00","title":"Janice Potters","service":"Haircut & Colour","service_id":"66","client_note":"","stylist_note":"","utc_start":"1295388000","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295394300"},{"id":"3743","start":"2011-01-18T15:45:00-08:00","end":"2011-01-18T16:45:00-08:00","title":"Angus Middleton","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1295394300","email":"angusman#hotmaile.com","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295397900"},{"id":"3025","start":"2011-01-19T08:00:00-08:00","end":"2011-01-19T09:45:00-08:00","title":"Jen Cannor","service":"Haircut & Highlights","service_id":"67","client_note":"","stylist_note":"","utc_start":"1295452800","email":"jen.c#cannorfarms.net","home_ph":"232-433-2222","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295459100"},{"id":"3026","start":"2011-01-19T10:00:00-08:00","end":"2011-01-19T11:45:00-08:00","title":"Karen Walker","service":"Haircut & Colour","service_id":"66","client_note":"","stylist_note":"","utc_start":"1295460000","email":"karenwalker#officesurplusdirect.net","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295466300"},{"id":"3027","start":"2011-01-19T11:45:00-08:00","end":"2011-01-19T12:45:00-08:00","title":"Amanda Brenner","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1295466300","email":"amandab#coastfitness.com","home_ph":"555-235-2366","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295469900"},{"id":"3028","start":"2011-01-19T13:00:00-08:00","end":"2011-01-19T14:30:00-08:00","title":"Mary Thacker","service":"Root Colour","service_id":"69","client_note":"","stylist_note":"","utc_start":"1295470800","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295476200"},{"id":"3029","start":"2011-01-19T14:30:00-08:00","end":"2011-01-19T15:00:00-08:00","title":"Malcolm Anderson","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1295476200","email":"malcolm#testserveraddy.com","home_ph":"240-444-4444","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1295478000"},{"id":"4856","start":"2011-03-09T09:00:00-08:00","end":"2011-03-09T10:00:00-08:00","title":"Simon Chalk","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299690000","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299693600"},{"id":"4858","start":"2011-03-09T10:00:00-08:00","end":"2011-03-09T10:15:00-08:00","title":"Brian Lytton","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299693600","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299694500"},{"id":"4859","start":"2011-03-09T10:15:00-08:00","end":"2011-03-09T10:30:00-08:00","title":"Brad Wicker","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299694500","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299695400"},{"id":"4860","start":"2011-03-09T10:30:00-08:00","end":"2011-03-09T10:45:00-08:00","title":"Brad Wicker","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299695400","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299696300"},{"id":"4861","start":"2011-03-09T10:45:00-08:00","end":"2011-03-09T11:00:00-08:00","title":"Brian Lytton","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299696300","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299697200"},{"id":"4862","start":"2011-03-09T11:00:00-08:00","end":"2011-03-09T11:15:00-08:00","title":"Brian Lytton","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299697200","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299698100"},{"id":"4863","start":"2011-03-09T11:15:00-08:00","end":"2011-03-09T11:30:00-08:00","title":"Simon Chalk","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299698100","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299699000"},{"id":"4864","start":"2011-03-09T11:30:00-08:00","end":"2011-03-09T11:45:00-08:00","title":"Chester Welling","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299699000","email":"chester#eastern.pharma.net","home_ph":"604-555-5555","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299699900"},{"id":"4865","start":"2011-03-09T11:45:00-08:00","end":"2011-03-09T12:00:00-08:00","title":"Brad Wicker","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299699900","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299700800"},{"id":"4866","start":"2011-03-09T12:00:00-08:00","end":"2011-03-09T13:00:00-08:00","title":"Janice Potters","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299700800","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299704400"},{"id":"4867","start":"2011-03-09T13:00:00-08:00","end":"2011-03-09T13:15:00-08:00","title":"Jacqui Chan","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299704400","email":"jc#rebelfrontier.net","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299705300"},{"id":"4876","start":"2011-03-09T13:15:00-08:00","end":"2011-03-09T13:30:00-08:00","title":"Mary Thacker","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299705300","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299706200"},{"id":"4868","start":"2011-03-10T10:15:00-08:00","end":"2011-03-10T11:15:00-08:00","title":"Trisha Roberts","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299780900","email":"trb483408#gmail.com","home_ph":"604-555-5555","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299784500"},{"id":"4870","start":"2011-03-10T11:30:00-08:00","end":"2011-03-10T12:30:00-08:00","title":"Jenson Bryant","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299785400","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299789000"},{"id":"4872","start":"2011-03-10T12:45:00-08:00","end":"2011-03-10T13:00:00-08:00","title":"Jenson Bryant","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299789900","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299790800"},{"id":"4873","start":"2011-03-10T13:00:00-08:00","end":"2011-03-10T13:15:00-08:00","title":"Jenson Bryant","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299790800","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299791700"},{"id":"4874","start":"2011-03-10T13:15:00-08:00","end":"2011-03-10T14:15:00-08:00","title":"Simon Chalk","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299791700","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299795300"},{"id":"4875","start":"2011-03-11T10:15:00-08:00","end":"2011-03-11T11:15:00-08:00","title":"Karen Walker","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299867300","email":"karenwalker#officesurplusdirect.net","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299870900"},{"id":"4877","start":"2011-03-11T12:00:00-08:00","end":"2011-03-11T12:15:00-08:00","title":"Amanda Brenner","service":"Women's Haircut","service_id":"65","client_note":"","stylist_note":"","utc_start":"1299873600","email":"amandab#coastfitness.com","home_ph":"555-235-2366","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299874500"},{"id":"4878","start":"2011-03-11T12:30:00-08:00","end":"2011-03-11T13:30:00-08:00","title":"Arnold Fieldman","service":"Men's haircut","service_id":"61","client_note":"","stylist_note":"","utc_start":"1299875400","email":"","home_ph":"","mobile_ph":"","work_ph":"","work_ext":"","utc_end":"1299879000"}], "next_page_num":"7"}
This is not a Sencha Touch specific issue: there are limits on the size of Ajax response that mobile safari can handle: see Too large an AJAX response for mobile safari?
Update: apparently this is not a mobile safari problem, this is a cellular network problem. Some networks will helpfully "paginate" the Ajax call -- thinking it's a regular web page download. Can you check to see if this is still the case on a wifi network?
After much head banging it appears that Sencha Touch stores only work well with up to approximately 10,000 characters I'm guess 8192 + the json delimiters?
After that it seems to start losing part of the data for us.
Can anyone else corroborate this?

Resources