| Index: third_party/grpc/examples/python/helloworld/greeter_client.py
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py b/third_party/grpc/examples/python/helloworld/greeter_client.py
|
| similarity index 75%
|
| copy from third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py
|
| copy to third_party/grpc/examples/python/helloworld/greeter_client.py
|
| index 429f58186e3fce43dc21e81e0f9d7e20c7e0bf70..561b25bcb2e2651965dfa744cc0431bbde8bf891 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py
|
| +++ b/third_party/grpc/examples/python/helloworld/greeter_client.py
|
| @@ -1,4 +1,4 @@
|
| -# Copyright 2010, Google Inc.
|
| +# Copyright 2015, Google Inc.
|
| # All rights reserved.
|
| #
|
| # Redistribution and use in source and binary forms, with or without
|
| @@ -27,20 +27,21 @@
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +"""The Python implementation of the GRPC helloworld.Greeter client."""
|
|
|
| -from mod_pywebsocket import msgutil
|
| +from grpc.beta import implementations
|
|
|
| +import helloworld_pb2
|
|
|
| -_GOODBYE_MESSAGE = 'Goodbye'
|
| +_TIMEOUT_SECONDS = 10
|
|
|
|
|
| -def web_socket_do_extra_handshake(request):
|
| - pass # Always accept.
|
| +def run():
|
| + channel = implementations.insecure_channel('localhost', 50051)
|
| + stub = helloworld_pb2.beta_create_Greeter_stub(channel)
|
| + response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'), _TIMEOUT_SECONDS)
|
| + print "Greeter client received: " + response.message
|
|
|
|
|
| -def web_socket_transfer_data(request):
|
| - while True:
|
| - line = msgutil.receive_message(request)
|
| - msgutil.send_message(request, line)
|
| - if line == _GOODBYE_MESSAGE:
|
| - return
|
| +if __name__ == '__main__':
|
| + run()
|
|
|