Rails + Flex via sockets? - ruby-on-rails

Can you advice something in building a Rails app that would nicely communicate with Flex via sockets. Currently I found only two ways of communication: Simple HttpRequest, RemoteObject. But I need something "multiplayer" style. I need Flex to talk to sockets and Rails app to grab data from those sockets do some job and push something back to a socket so Flex could read it "on the fly".
Any poor design flow? :) Thx in advance.

Depends on what exactly you need it to do and how responsive you need it. You can look into the Ruby AMF plugin which is a native type for Flash, which makes transferring classes a breeze. The Java implementation has a streaming server built in, not sure if the Ruby version does.
Other than that, if you want it to be really responsive, you could 2 different approaches: an RTMP server (SmartFoxServer, Wowza, Red5, LCDS, etc - all Java based) or you could try to do p2p (Adobe calls it Cirrus - and it's still in pre-production). If you do use the p2p route, you still need a fallback in case something goes funky.

Related

Using sockets to build real time chat for iOS?

If I wanted to build a real time chat app for iOS using Objective-C, what would be the best way of going about it?
Assuming you've got your server side things setup, you can use Square's Socket Rocket to implement the client side https://github.com/square/SocketRocket
If you're using socket.io at the backend, there are plenty of iOS libraries available for those as well. SIOSocket is one such library.
Maybe I am just lazy, but I do not see a point in building it all from scratch.
There are a plenty of backend providers who will be happy to provide you with ready backend and a library for building your app.
So, you'll just need to connect the solution to your project and make UI according to your needs.
Here are some backend providers you might consider:
ConnectyCube
Firebase
Sendbird
Layer
etc.
They provide different set of features, so I'd recommend checking those they provide first.
This article might be of some help as well.
Some of them like ConnectyCube can provide you also with development services, so you can order UI development according to your mockup design from them too.

Need to convert a Sencha Touch + NodeJs + MongoDB app to Native apps

Based on our user feedback, we would like to convert our Hybrid app built using Sencha Touch on Node JS & MongoDb to pure Native apps for both IOS and Android. Having built a lot of logic and data, what are our most optimal choices to keep as much of backend REST API code as possible and save on time, cost and effort.
Thanks
If your API endpoints are properly detached from the rest of the app, you will only have to rewrite the native logic for iOS and Android. If everything is intertwined then the first thing you need to do is separate the API calls into their own self sustained application.
Before discarding ST be sure you are getting the best performance possible:
1.- build for production with sencha CMD.
2.- be sure you are not over-nesting components (more than needed).
3.- use container when possible instead of panels
4.- if possible avoid nested lists
5.- be sure you are not creating components over and over again when you can show / hide them.
6.- be aware of memory leaks.
7.- Smart DOM query e.g this.down('myPanel') instead of Ext.ComponentQuery.query('myPanel')
8.- Make the UI to respond while server side is processing stuff (use of masks and stuff like that)
I'm sure there are more things you can do to get the best out of the framework, research them.
I believe Sencha Touch is awesome, look for some of the demos they have and if the performance of those apps are like the one you have and you still don't like it, then ok move to native.
In good ST apps users aren't able to tell if it's hybrid or native.
UPDATE
BTW you are using something like Cordova or PhoneGap to package it right ?

Native Windows Phone app vs Jquery Mobile + PhoneGap?

I am new to mobile programming, and I want to build a mobile app to fill few forms, offline, and then sync them later, when internet access is available, with a database on an online server through a VPN connection.
At first, I thought about learning Windows8 Phone App development, but then I heard/read about Phonegap and Jquery Mobile! and I am a bit confused which one would be better to use, considering two things:
1- Which one you think would be good for my app's functionality
2- Which tool would be more beneficial on the long run (in the mobile programming world).
Any advice would be very much appreciated.
With these functionality I don't thing you don't need many mobile dependent features rather you need more web features. For your first question, answer could be that technology in which you are more comfortable. But it also depends how you want to sync your data. In background or when the app is open. If you want to sync data in background that means app is closed, you have some data to send in server, and internet access is there, then you'll need some native windows phone code. In that case if you use phonegap ultimately you will need some native code to deal with it, may be you'll need to write a plugin to communicate between phonegap and native code. And if you don't need background process, if you want to send data to server only when your app is opened,phonegap can work like a charm. It'll be easy to communicate between 2 web technology.
For your second question, ofcourse phonegap is great technology to learn to deal with cross platform. If you need to make apps not only for WP rather for all platforms then phonegap is great. Having said that it's necessary to mention phonegap has it's quirks too. Native code always has it's benefit. Phonegap can't completely overcome native code. But if you are willing to compromise a bit, then it's easy to learn phonegap,a familiar tech than all those platform dependent techs like objective-c, android etc.
(N.B. I'm not an expert, it's just my experience so far)

ActionScript Socket vs WebSocket

I'm working on a Flash based networked game. I have to choose between ActionScript sockets and WebSockets (or more specifically socket.io). I'm wondering which is the better choice. I'm leaning toward ActionScript sockets since it (should) will be standard across all browsers. With socket.io, WebSockets can only be used in HTML5 and it can even result to polling for some older browsers which is a big issue.
Would you guys say that ActionScript sockets is the better choice?
Thank you very much!
The world is moving towards WebSockets (and HTML5, in general).
Flash is becoming more challenging than ever, given that many tablets, smartphones (and even IE10 in Metro style) don't support plugins. Adobe announced that they will stop developing Flash for mobile browsers. Flash may be OK for the purposes of your application, but it's pretty clear that at this point HTML5 is way more "future proof" than Flash.
As for the browser support for HTML5 and specifically WebSockets: some of the WebSocket servers provide very clever emulation techniques that on one hand allow the developer to code against the WebSocket APIs, on the other hand automatically select the best transport layer under the given circumstances (browser, platform, proxies, routers, and other intermediaries). For example, the Kaazing WebSocket Gateway [disclosure: I work for Kaazing] does emulation exceptionally well (check out this blog post if interested in WebSocket emulation using older browsers, including IE6).
And one more thing: if Flash is a technology you're familiar with and need to use for development, Kaazing has WebSocket APIs for Flash, Flex, Air (as well as Java, .Net, and obviously JavaScript) as well.
Overall, I'd definitely go the WebSockets route today.

Can i call a web service from FireMonkey for iOS?

I'm new to iOS, have been developing in Delphi for many years.
I don't know FPC well and i find it very hard to figure out which classes are available on iOS.
is there any FireMonkey classes for calling web services and parsing xml?
Yes you can call a webservice :)
No it is not simple :(
You need to access the iOS framework directly...
The following code fragments will help...
First a pascal example of how to send/receive data via TCP
https://forums.embarcadero.com/thread.jspa?messageID=397346
Secondly, you will need to wrap the call using the relevant headers. See...
http://books.google.com.au/books?id=0nTYIL3-0yoC&pg=PT518&lpg=PT518&dq=beginning+ipad+development+webservices&source=bl&ots=cYniLvL8z2&sig=Ci6HskHgMvUeIrjyUbDecd7fBCQ&hl=en&ei=0_KdTpzBB4nOrQfwzM29CQ&sa=X&oi=book_result&ct=result&resnum=6&ved=0CEAQ6AEwBQ#v=onepage&q&f=true
It is a fair bit of work, but it can be done. Good luck!
You can also try to use RealThinClient (RTC) SDK to allow your Delphi XE2 FireMonkey iOS client to connect to a RTC SDK server. Not SOAP, but I've managed to send data back and forth between the two layers (just in case you do not have to use SOAP, but are merely looking for some way to connect an iOS client to a server)...

Resources