Electron app that opens a server or using sockets over the web - sockets

Im making an app that multiple players can connect to, but im brainstorming the best approach.
Im going to be using electron for the interface and then be able to use other computers to log in to website to join the game with multiple players.
I will use sockets to connect to each player, but what i am trying to figure out is whats the best approach for the interface.
Should i use express with electron to somehow connect to the same website the players are on?
Is it possible to make the electron app start up a server and have my website direct to the computer that is running the electron app?
Or my other option was to just continuously upload and download from a database, but I feel like that would not be very efficient.

You're on the right track. I would suggest using a WebSocket based server / client architecture.
The server application is continuously running and handles inter-player communication as well as providing a database. The database could be integrated in the server application as a starting point, and, depending on your needs concerning scalability, be extracted as a standalone service in the long run.
Client applications could then come in many forms (a website, a desktop application, a mobile app). Using electron is a great way to enable cross-platform desktop application development that is adaptable to any of these scenarios, possibly also enabling to extract the contained web application as either a hosted website or even mobile application (using, for example, react-native or nativescript).
Good luck!

Related

Is it possible to build a VPN without an actual server?

After searching online most places have stated that it is required to have a server to build a VPN, but I was wondering if it is possible to do it and have mobile devices connect to a dummy server? Without actually having something constantly running on a server.
I am currently developing an app that will make users connect to a VPN that blocks access to all sites.
Define "server". If you are worried about cost of hardware/power, bear in mind that a server is just a computer that hosts applications or data for clients to access and interact with. I currently have a Dell latitude e6400 running as an owncloud server in my basement. If you need something for testing you could simply utilize whatever old hardware you have laying around to set up the server side for your app to connect to, and turn it on whenever you are testing the app.

How to connect a C# Windows mobile 6.5 app to a Postgres database?

I'm developing an application for Windows Mobile 6.5 that needs to get and send data from a Postgres database within the network of the app.
I've googled it and read every page on the matter but haven't been able to find a solution.
The npgsql driver doesn't work on this sdk.
Much like for Android or iOS, I'd recommend that you build an intermediary web service that's provided by a server on the Internet that the phones talk to instead of talking directly to the database. The web service would accept REST+JSON, REST+XML, XML-RPC, SOAP, or whatever your preferred web service procotol is from the phone clients. It'd act on the requests from the phones, doing whatever is needed in the database to satisfy the request, and return any result via the web service protocol.
This means your individual phones don't need connections direct to PostgreSQL - a good thing, since phone network connections are flakey and the retry/re-establish logic can be hard to get right. You'd land up with lots of dangling connections to the Pg server. You're much better off with a stateless protocol like HTTP to talk to a web service that then does the real work.
Choose whatever web service protocol is easiest to work with on Windows Phone 6.5 and implement it using your preferred back-end server. In your case I imagine that's likely to be .NET on IIS.
Depending on the app, you might already have a web service protocol. If you have a modern web page version then it's fairly likely to use JavaScript with REST+JSON to call server endpoints, in which case you may just be able to extend and re-use those for the phone app.

How can I implement multiplayer in my iphone game?

I want to create a playstation home style multiplayer game for iphone. How can I implement multiplayer in my project? Also, how can I give players a chance to chat? How can I let them create their own avatars to interact? I am a one man developer, with no access to servers. Maybe I can use iPhone game centre???
If you're looking for some kind of platform to build on, there is a product called SmartFoxServer:
http://www.smartfoxserver.com/
I have not used it, but it claims to provide a client API for native Obj-C or Unity3D. It allows for chat features.
If you want to roll your own, I recommend getting started with NodeJS:
http://nodejs.org/
GameCenter does not provide any kind of backend for multiplayer networking, at least not in the way you are implying. If you intend to build a networked multiplayer game over the internet, you most likely need some kind of backend.
Slicehost is a good way of getting a server like NodeJS running quickly and cheaply:
http://www.slicehost.com/
Don't forget that GameKit in iOS allows multiple devices to find each other locally (via Bluetooth or local Wifi) and create sessions. This might be a good starting point for your game. Here's some info on GameKit:
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html
I think this would usually be done with webservice interaction against a server. You may be able to develop a webservice and pay a small fee to have it hosted by a web provider, or to use your own machine as (an unreliable) server while proving the concept.
Or you could just use Nextpeer - http://www.nextpeer.com
It makes adding online tournaments to your game real simple.
You can look at Gamooga (http://www.gamooga.com/).
Its a realtime communication platform for multiplayer games so you dont need to worry about building and deploying your own multiplayer servers. You can upload your own server side scripts onto Gamooga's cluster which receive and process your clients' messages. You can use Gamooga's iOS API with in your app to send messages from the client side to your server side scripts. You can download the SDK and look at the demos to start off.
There is a free plan of Gamooga platform too that you can make use of to start with.
Disclosure: I am founder of Gamooga, replying only since its relevant to the question.

iPhone network communication with pc

I want to make an iPhone app and an application (server) which runs on a PC with Windows. Is there any easy way to do this on the client side (the iPhone), like a library or something?
Looking on Google I found cocoaasyncsocket and xmppframework, but the last commits were done some time ago and before I start my project I want to know if there are other (better) possibilities out there
One option would be to run a web server on the PC, with a set of REST-based services. This approach gives you lots of options for implementation on the server-side, and you'll have lots of possible frameworks to choose from on the client-side as well. One framework you could use on the iPhone is ASIHTTPRequest.
There are lots of advantages to using a web-based approach. There are HTTP frameworks built for almost every device and platform, so if you ever want to interact with the server from the web, an Android device, etc., there will be many tools to help you do that. There are also lots of great tools out there for debugging HTTP interactions.
You could also use a SOAP-based API, but in my opinion SOAP tends to be more complicated than its worth.

How do I write a desktop application that syncs with the iPhone?

For example, how would I write a program like senuti? Are there any libraries I can use for this? It would be ideal if I could do this in Python or .Net, but I'm open to other things as well.
There are three things you can do:
Add some code to your iPhone application which acts as some kind of server (http, SMB, etc). Then your mac/windows full client application can connect to this server over wifi. This is safe and reliable, but unfortunately the app will have to be running on the iPhone at the time of sync.
Sync to the "cloud". EG: Have your iPhone app save some data to a web server on the internet (you could use amazon EC2, windows Azure, or even just a PHP script running on a cheap hosting account), and then have your windows/mac client also connect to this web server to retrieve the data. This is the most user-friendly, but it requires you to pay for the hosting of the web server, and will be unsuitable for large amounts of data
Violate the EULA and try to reverse engineer the way iTunes communicates with the iPhone.
This is how senuti works, but I wouldn't recommend it, as they're constantly having to play catchup with apple changing the format underneath them, and they are probably exposed to some kind of legal action, if apple ever bothered to sue them.
i believe Version 3.0 will resolve this as it allows you to program apps to the USB interface. check out some of the documentation for that in the External Accessory framework.
it would still require the app to be open, so essentially would mean two syncs (or more if you have multiple apps)
There is no legal / official way of doing this. Creating a program that would sync with an iPhone would violate the EULA you agree to when using the iPhone and iTunes.
Not only is it illegal, but it's also impossible to do this reliably. Apple could break the method at any time without any notice, and it would pretty much be a cat-and-mouse game.
I only know of one application that something of the kind, and it is the iToner application which synchronizes ringtones.