diff --git a/src/com/strumsoft/websocket/phonegap/WebSocket.java b/src/com/strumsoft/websocket/phonegap/WebSocket.java index 736e6cd..b9a070f 100755 --- a/src/com/strumsoft/websocket/phonegap/WebSocket.java +++ b/src/com/strumsoft/websocket/phonegap/WebSocket.java @@ -399,7 +399,7 @@ public int getReadyState() { private String buildJavaScriptData(String event, String msg) { String _d = "javascript:WebSocket." + event + "(" + "{" + "\"_target\":\"" + id + "\"," + "\"data\":'" + msg.replaceAll("'", "\\\\'") + "'" + "}" + ")"; - return _d; + return _d.replaceAll("\n", "\\\\n"); } // ////////////////////////////////////////////////////////////////////////////////////// @@ -474,6 +474,9 @@ private void _writeHandshake() throws IOException { if (path.indexOf("/") != 0) { path = "/" + path; } + if (uri.getRawQuery() != null) { + path += "?" + uri.getRawQuery(); + } String host = uri.getHost() + (port != DEFAULT_PORT ? ":" + port : ""); String origin = "*"; // TODO: Make 'origin' configurable