Attachment 'chandrika-parimoo-task-websocketpp.patch'
Download 1 --- original_echo_client.cpp 2013-05-16 03:56:21.211877022 +0530
2 +++ echo_client.cpp 2013-05-16 03:41:53.181242051 +0530
3 @@ -1,31 +1,3 @@
4 -
5 -/*
6 -* Copyright (c) 2011, Peter Thorson. All rights reserved.
7 -*
8 -* Redistribution and use in source and binary forms, with or without
9 -* modification, are permitted provided that the following conditions are met:
10 -* * Redistributions of source code must retain the above copyright
11 -* notice, this list of conditions and the following disclaimer.
12 -* * Redistributions in binary form must reproduce the above copyright
13 -* notice, this list of conditions and the following disclaimer in the
14 -* documentation and/or other materials provided with the distribution.
15 -* * Neither the name of the WebSocket++ Project nor the
16 -* names of its contributors may be used to endorse or promote products
17 -* derived from this software without specific prior written permission.
18 -*
19 -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 -* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
23 -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 -*
30 -*/
31 -
32 #include "../../src/roles/client.hpp"
33 #include "../../src/websocketpp.hpp"
34
35 @@ -35,13 +7,16 @@
36
37 class echo_client_handler : public client::handler {
38 public:
39 - void on_message(connection_ptr con, message_ptr msg) {
40 - if (con->get_resource() == "/getCaseCount") {
41 - std::cout << "Detected " << msg->get_payload() << " test cases." << std::endl;
42 - m_case_count = atoi(msg->get_payload().c_str());
43 - } else {
44 - con->send(msg->get_payload(),msg->get_opcode());
45 - }
46 + void on_message(connection_ptr con, message_ptr msg) {
47 + std::cout << msg->get_payload() << std::endl;
48 + m_case_count = atoi(msg->get_payload().c_str());
49 + }
50 +
51 + void on_open(connection_ptr con){
52 + //SIP_msg :example OPTIONS message
53 + std::string SIP_msg;
54 + SIP_msg=" OPTIONS sip:carol@chicago.com SIP/2.0 Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKhjhs8ass877 Max-Forwards: 70 To: <sip:carol@chicago.com> From: Alice <sip:alice@atlanta.com>;tag=1928301774 Call-ID: a84b4c76e66710 CSeq: 63104 OPTIONS Contact: <sip:alice@pc33.atlanta.com> Accept: application/sdp Content-Length: 0\r\n\r\n";
55 + con->send(SIP_msg.c_str());
56 }
57
58 void on_fail(connection_ptr con) {
59 @@ -58,7 +33,8 @@
60 if (argc == 2) {
61 uri = argv[1];
62
63 - } else if (argc > 2) {
64 + }
65 + else if (argc > 2) {
66 std::cout << "Usage: `echo_client test_url`" << std::endl;
67 }
68
69
70 endpoint.alog().unset_level(websocketpp::log::alevel::ALL);
71 endpoint.elog().unset_level(websocketpp::log::elevel::ALL);
72
73 - con = endpoint.connect(uri+"getCaseCount");
74 + con = endpoint.connect(uri);
75
76 endpoint.run();
77
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.
