Created
December 29, 2019 07:30
-
-
Save gistlyn/d551e6ba1378945481f64679c1f57230 to your computer and use it in GitHub Desktop.
Swift Google protoc insecure GrpcServicesClient TodoWorld Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import GRPC | |
import NIO | |
import NIOSSL | |
do { | |
let configuration = ClientConnection.Configuration( | |
target: .hostAndPort("todoworld.servicestack.net", 5054), | |
eventLoopGroup: MultiThreadedEventLoopGroup(numberOfThreads: 1) | |
) | |
let client = GrpcServicesServiceClient(connection: ClientConnection(configuration: configuration)) | |
var request = Hello() | |
request.name = "gRPC Swift" | |
let response = try client.getHello(request).response.wait().result | |
print(response) | |
} catch { | |
print("ERROR\n\(error)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment