Server side swift application ?

Hi Swift programmers,

I would like to ask for opinions or feedback about server side application with swift.
Is it realistic to think about creating an application server with swift ?
I would love to develop games with both client and server in Swift and get rid of any other technologies in my stack but I am not sure that it’s a good idea for now.
I know that IBM started to allows server side Swift in their cloud though probably not many people use it for now as it’s a very recent work.

So does that seem possible for you to develop, host and maintain a game server with Swift or should I keep using more common server side technologies like C++, Node.js… ?

Hopefully, you can give me advices and help me to choose the best solution.

Cheers,

Raphaël

Hi Raphael,

I took a look at the current Kitura (Swift-IBM) code and they appear to be using libdispatch, but only to put there blocking calls off the main queue: https://github.com/IBM-Swift/Kitura-net/blob/master/Sources/KituraNet/HttpServerSpi.swift#L52\.

This might be because libdispatch on Linux is not mature, I’m not sure. I haven’t benchmarked it or anything so it might be sufficient for what you are looking for.

I’ve been looking into libuv which is the async IO library that Node.js is built on top of, but you would still have to wrap it in Swift. I’m currently trying to see what it would be like to replicate some of libuv’s functionality with libdispatch. libuv and libdispatch overlap on functionality quite a bit, but libdispatch has the benefit of using a block API instead of a function pointer API, which makes memory management easier in Swift. However, libuv has many additional features for setting up TCP connections and other networking constructs.

Hope that helps a little bit, I’m exploring this area myself!

Tyler

···

On May 1, 2016, at 7:48 AM, Raphaël Wach via swift-users <swift-users@swift.org> wrote:

Hi Swift programmers,

I would like to ask for opinions or feedback about server side application with swift.
Is it realistic to think about creating an application server with swift ?
I would love to develop games with both client and server in Swift and get rid of any other technologies in my stack but I am not sure that it’s a good idea for now.
I know that IBM started to allows server side Swift in their cloud though probably not many people use it for now as it’s a very recent work.

So does that seem possible for you to develop, host and maintain a game server with Swift or should I keep using more common server side technologies like C++, Node.js… ?

Hopefully, you can give me advices and help me to choose the best solution.

Cheers,

Raphaël
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

This is certainly possible even today. There are many vibrant initiatives in this space that make it usable. I wouldn’t use it in production for another couple years until the dust settles and gets battle tested in real-world production scenarios (think how long Node.js took to be adopted by enterprise companies). If Apple were to officially release a Swift server, it would definitely accelerate this process.

···

On May 1, 2016, at 10:48 AM, Raphaël Wach via swift-users <swift-users@swift.org> wrote:

Hi Swift programmers,

I would like to ask for opinions or feedback about server side application with swift.
Is it realistic to think about creating an application server with swift ?
I would love to develop games with both client and server in Swift and get rid of any other technologies in my stack but I am not sure that it’s a good idea for now.
I know that IBM started to allows server side Swift in their cloud though probably not many people use it for now as it’s a very recent work.

So does that seem possible for you to develop, host and maintain a game server with Swift or should I keep using more common server side technologies like C++, Node.js… ?

Hopefully, you can give me advices and help me to choose the best solution.

Cheers,

Raphaël
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Fwiw, I already have some swift code deployed in my internal server clusters.

···

Sent from my iPhone

On May 1, 2016, at 12:40 PM, Basem Emara via swift-users <swift-users@swift.org> wrote:

This is certainly possible even today. There are many vibrant initiatives in this space that make it usable. I wouldn’t use it in production for another couple years until the dust settles and gets battle tested in real-world production scenarios (think how long Node.js took to be adopted by enterprise companies). If Apple were to officially release a Swift server, it would definitely accelerate this process.

On May 1, 2016, at 10:48 AM, Raphaël Wach via swift-users <swift-users@swift.org> wrote:

Hi Swift programmers,

I would like to ask for opinions or feedback about server side application with swift.
Is it realistic to think about creating an application server with swift ?
I would love to develop games with both client and server in Swift and get rid of any other technologies in my stack but I am not sure that it’s a good idea for now.
I know that IBM started to allows server side Swift in their cloud though probably not many people use it for now as it’s a very recent work.

So does that seem possible for you to develop, host and maintain a game server with Swift or should I keep using more common server side technologies like C++, Node.js… ?

Hopefully, you can give me advices and help me to choose the best solution.

Cheers,

Raphaël
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

libuv and libdispatch overlap on functionality quite a bit, but libdispatch has the benefit of using a block API instead of a function pointer API, which makes memory management easier in Swift.

I think libdispatch would be the better choice, since it’s what’s going to be used in Swift’s standard library going forward.

However, libuv has many additional features for setting up TCP connections and other networking constructs.

The dispatch_io API lets you use libdispatch with file descriptors, so working with TCP would just involve making the usual system calls to open the connection and then creating a dispatch_io_t from the FD. It should just take a couple of lines of code.

—Jens

···

On May 1, 2016, at 11:48 AM, Tyler Fleming Cloutier via swift-users <swift-users@swift.org> wrote:

Server-side Swift is not mature by any measure, but there are very vibrant
groups building a few competing solutions, outside the IBM group. I've
already built a low-importance, in-production server using Vapor
<https://github.com/qutheory/vapor&gt;\. There's another group called Zewo
<https://github.com/Zewo/Zewo&gt; also building web frameworks and underlying
technology. In an attempt to make the quickly-emerging frameworks pluggable
into each other, these spec-like <https://github.com/open-swift&gt; libraries
were created. Another collection of frameworks in nestproject
<https://github.com/nestproject&gt;, which aims at standardizing the web
server/web application interface.

There are many more projects, but I've contributed to these three and there
are many very active people trying to create production-ready tools by the
time Swift 3 is released. Again, you can already build servers today, but
expect Swift and APIs to change frequently until Swift 3 drops. So if you'd
like to contribute, these might be a good place to start.

···

On Sun, May 1, 2016 at 10:09 PM Dru Satori via swift-users < swift-users@swift.org> wrote:

Fwiw, I already have some swift code deployed in my internal server
clusters.

Sent from my iPhone

> On May 1, 2016, at 12:40 PM, Basem Emara via swift-users < > swift-users@swift.org> wrote:
>
> This is certainly possible even today. There are many vibrant
initiatives in this space that make it usable. I wouldn’t use it in
production for another couple years until the dust settles and gets battle
tested in real-world production scenarios (think how long Node.js took to
be adopted by enterprise companies). If Apple were to officially release a
Swift server, it would definitely accelerate this process.
>
>> On May 1, 2016, at 10:48 AM, Raphaël Wach via swift-users < > swift-users@swift.org> wrote:
>>
>> Hi Swift programmers,
>>
>> I would like to ask for opinions or feedback about server side
application with swift.
>> Is it realistic to think about creating an application server with
swift ?
>> I would love to develop games with both client and server in Swift and
get rid of any other technologies in my stack but I am not sure that it’s a
good idea for now.
>> I know that IBM started to allows server side Swift in their cloud
though probably not many people use it for now as it’s a very recent work.
>>
>> So does that seem possible for you to develop, host and maintain a game
server with Swift or should I keep using more common server side
technologies like C++, Node.js… ?
>>
>> Hopefully, you can give me advices and help me to choose the best
solution.
>>
>> Cheers,
>>
>> Raphaël
>> _______________________________________________
>> swift-users mailing list
>> swift-users@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
>
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

libuv and libdispatch overlap on functionality quite a bit, but libdispatch has the benefit of using a block API instead of a function pointer API, which makes memory management easier in Swift.

I think libdispatch would be the better choice, since it’s what’s going to be used in Swift’s standard library going forward.

However, libuv has many additional features for setting up TCP connections and other networking constructs.

The dispatch_io API lets you use libdispatch with file descriptors, so working with TCP would just involve making the usual system calls to open the connection and then creating a dispatch_io_t from the FD. It should just take a couple of lines of code.

Indeed!

https://github.com/TheArtOfEngineering/Edge/blob/master/Sources/TCP.swift

···

On May 3, 2016, at 12:14 PM, Jens Alfke <jens@mooseyard.com> wrote:

On May 1, 2016, at 11:48 AM, Tyler Fleming Cloutier via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

—Jens

A good reading

Usable In Swift, even if the umbrella module did not work for me, I had to compile it in my own workspace to use it in swift code

Regards

Gérard

···

Le 3 mai 2016 à 21:17, Tyler Cloutier via swift-users <swift-users@swift.org> a écrit :

On May 3, 2016, at 12:14 PM, Jens Alfke <jens@mooseyard.com> wrote:

On May 1, 2016, at 11:48 AM, Tyler Fleming Cloutier via swift-users <swift-users@swift.org> wrote:

libuv and libdispatch overlap on functionality quite a bit, but libdispatch has the benefit of using a block API instead of a function pointer API, which makes memory management easier in Swift.

I think libdispatch would be the better choice, since it’s what’s going to be used in Swift’s standard library going forward.

However, libuv has many additional features for setting up TCP connections and other networking constructs.

The dispatch_io API lets you use libdispatch with file descriptors, so working with TCP would just involve making the usual system calls to open the connection and then creating a dispatch_io_t from the FD. It should just take a couple of lines of code.

Indeed!

https://github.com/TheArtOfEngineering/Edge/blob/master/Sources/TCP.swift

—Jens

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

This is highly Mac/iOS-specific code, so it doesn’t make sense for applications targeted at servers.

Also, I’ve used CocoaAsyncSocket and it’s IMHO greatly overcomplicated for what it does. There is a LOT of code in there, and a fair amount of the complexity seems to be to work around obsolete limitations of iOS networking that are no longer relevant.

—Jens

···

On May 3, 2016, at 12:46 PM, Gerard Iglesias <gerard_iglesias@me.com> wrote:

A good reading

GitHub - robbiehanson/CocoaAsyncSocket: Asynchronous socket networking library for Mac and iOS

Thank you all for your feedback. That’s really helpful.

I understand that there is a lot of work in progress regarding server-side Swift and I’ll keep investigating this field though as nothing looks stable for now I’ll stick on Node.js in production for a while.
An Apple application server designed for Swift would really be awesome.
Hopefully, a good news at the incoming WWDC ? Who knows ;)

Cheers,

Raphaël

···

Le 3 mai 2016 à 23:03, Jens Alfke via swift-users <swift-users@swift.org> a écrit :

On May 3, 2016, at 12:46 PM, Gerard Iglesias <gerard_iglesias@me.com <mailto:gerard_iglesias@me.com>> wrote:

A good reading

GitHub - robbiehanson/CocoaAsyncSocket: Asynchronous socket networking library for Mac and iOS

This is highly Mac/iOS-specific code, so it doesn’t make sense for applications targeted at servers.

Also, I’ve used CocoaAsyncSocket and it’s IMHO greatly overcomplicated for what it does. There is a LOT of code in there, and a fair amount of the complexity seems to be to work around obsolete limitations of iOS networking that are no longer relevant.

—Jens
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Jens,

I have to say that I am far from an expert in low level network coding, even if I started using Distributed object in 93 with NeXTStep, and I can build network connection with the basics, listen, bind, accept ... There is an interesting network code in swift with these basics on the IBM swift playground.

I wonder what kind of limitations are no longer relevant ?

And I found CocoaAsync very interesting to read because of the intensive use of GCD

And maybe it would be interesting to know who use what today with swift to put a server or a client in use?

Regards

Gérard

···

Le 3 mai 2016 à 23:03, Jens Alfke <jens@mooseyard.com> a écrit :

On May 3, 2016, at 12:46 PM, Gerard Iglesias <gerard_iglesias@me.com> wrote:

A good reading

GitHub - robbiehanson/CocoaAsyncSocket: Asynchronous socket networking library for Mac and iOS

This is highly Mac/iOS-specific code, so it doesn’t make sense for applications targeted at servers.

Also, I’ve used CocoaAsyncSocket and it’s IMHO greatly overcomplicated for what it does. There is a LOT of code in there, and a fair amount of the complexity seems to be to work around obsolete limitations of iOS networking that are no longer relevant.

—Jens

Don't know if I'm late to this conversation. I have been using the perfect
<http://perfect.org> platform for server-side swift. My understanding was
it is the most robust platform, but I'm using it because my boss said so. I
haven't had any problems and I'm finding the community around it is growing
solid. If you want to give it a try, this tutorial
<https://medium.com/@abjurato/swift-perfect-mustache-and-postgresql-on-heroku-48d483fe8489#.4z8r26myq&gt;
is pretty solid.

Thanks,
Fareed

···

On Sun, May 8, 2016 at 1:08 PM, Gerard Iglesias via swift-users < swift-users@swift.org> wrote:

Jens,

I have to say that I am far from an expert in low level network coding,
even if I started using Distributed object in 93 with NeXTStep, and I can
build network connection with the basics, listen, bind, accept ... There is
an interesting network code in swift with these basics on the IBM swift
playground.

I wonder what kind of limitations are no longer relevant ?

And I found CocoaAsync very interesting to read because of the intensive
use of GCD

And maybe it would be interesting to know who use what today with swift to
put a server or a client in use?

Regards

Gérard

Le 3 mai 2016 à 23:03, Jens Alfke <jens@mooseyard.com> a écrit :

On May 3, 2016, at 12:46 PM, Gerard Iglesias <gerard_iglesias@me.com> > wrote:

A good reading

GitHub - robbiehanson/CocoaAsyncSocket: Asynchronous socket networking library for Mac and iOS

This is highly Mac/iOS-specific code, so it doesn’t make sense for
applications targeted at servers.

Also, I’ve used CocoaAsyncSocket and it’s IMHO greatly overcomplicated for
what it does. There is a LOT of code in there, and a fair amount of the
complexity seems to be to work around obsolete limitations of iOS
networking that are no longer relevant.

—Jens

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

--
www.FareedQ.com
Twitter @IAmFareedQ