[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15606324#comment-15606324
 ] 

ASF GitHub Bot commented on THRIFT-3773:
----------------------------------------

Github user apocolipse commented on the issue:

    https://github.com/apache/thrift/pull/1084
  
    @fumoboy007 so for clients you should be doing something like this:
    ```swift
    let factory = THTTPSessionTransport.Factory(url: serviceURL)
    let client = HermesAsyncClient(with: TBinaryProtocol.self, factory: factory)
    ```
    
    For servers, its all about the server, no need to have an async processor
    I'll need to update the Perfect HTTP Server example I have on my github for 
HTTP servers, but basically the setup is something like this (same as 
TSocketServer:
    ```swift
    let server = try? TSocketServer(port: 9090,
                                     service: MyConcreteService(), // your 
implementation of thrift service
                                     inProtocol: TBinaryProtocol.self,
                                     outProtocol: TBinaryProtocol.self,
                                     processor: MyServiceProcessor.self) // 
generated service processor
    ```
    Since it leverages generics, each request creates its own processor rather 
than re-using the same one over and over
    (If you look at the TSocketServer impl, you'll see something like
    ```swift
    let processor = Processor(service: self.serviceHandler)
    processor.process(on: inproto, outProtocol: outproto)
    ```)


> Swift Library
> -------------
>
>                 Key: THRIFT-3773
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3773
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Swift - Library
>            Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to