Support new WebSocket signaling format.

- Support new GAE message format and new signaling
sequence, which allows connection to 3-dot-apprtc server.
- Add UI setting to switch between GAE / WebSockets signaling.
- Some clean ups to better support command line application
execution.

BUG=3937,3995,4041
R=jiayl@webrtc.org, tkchin@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/27319004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7813 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
glaznev@webrtc.org
2014-12-04 17:28:52 +00:00
parent 0b38478885
commit 369746bcb8
11 changed files with 413 additions and 260 deletions

View File

@@ -140,7 +140,7 @@ public class WebSocketChannelClient {
json.put("cmd", "register");
json.put("roomid", roomID);
json.put("clientid", clientID);
Log.d(TAG, "WS SEND: " + json.toString());
Log.d(TAG, "C->WSS: " + json.toString());
ws.sendTextMessage(json.toString());
state = WebSocketConnectionState.REGISTERED;
// Send any previously accumulated messages.
@@ -176,7 +176,7 @@ public class WebSocketChannelClient {
json.put("cmd", "send");
json.put("msg", message);
message = json.toString();
Log.d(TAG, "WS SEND: " + message);
Log.d(TAG, "C->WSS: " + message);
ws.sendTextMessage(message);
} catch (JSONException e) {
reportError("WebSocket send JSON error: " + e.getMessage());
@@ -279,9 +279,9 @@ public class WebSocketChannelClient {
try {
for (WsHttpMessage wsHttpMessage : wsHttpQueue) {
// Send POST request.
Log.d(TAG, "WS " + wsHttpMessage.method + " : " +
String postUrl = postServerUrl + "/" + roomID + "/" + clientID;
Log.d(TAG, "WS " + wsHttpMessage.method + " : " + postUrl + " : " +
wsHttpMessage.message);
String postUrl = postServerUrl + roomID + "/" + clientID;
HttpURLConnection connection =
(HttpURLConnection) new URL(postUrl).openConnection();
connection.setDoOutput(true);
@@ -333,7 +333,7 @@ public class WebSocketChannelClient {
@Override
public void onTextMessage(String payload) {
Log.d(TAG, "WS GET: " + payload);
Log.d(TAG, "WSS->C: " + payload);
final String message = payload;
uiHandler.post(new Runnable() {
public void run() {