Created
March 7, 2018 04:38
-
-
Save JacopoMangiavacchi/c0b6b7e1f31456701bf4b5ce54816476 to your computer and use it in GitHub Desktop.
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 Thrift | |
import ThriftSwiftNio | |
class TestServiceHandler : TestService { | |
func Hello(HelloString: String) throws -> String { | |
return "Hello " + HelloString | |
} | |
func GetSampleStruct(key: Int32, value: String) throws -> SampleStruct { | |
return SampleStruct(key: key, value: value) | |
} | |
} | |
class TestProcessor : Processor { | |
func process(on inProtocol: TProtocol, outProtocol: TProtocol) throws { | |
let handler = TestServiceHandler() | |
let processor = TestServiceProcessor(service: handler) | |
do { | |
try processor.process(on: inProtocol, outProtocol: outProtocol) | |
} | |
catch { | |
print("Error in process") | |
} | |
} | |
} | |
let processor = TestProcessor() | |
let server = Server(host: "::1", port: 9090, with: processor, inProtocolType: TBinaryProtocol.self, outProtocolType: TBinaryProtocol.self) | |
server.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment