Socket server using business logic

Hi, is it possible to setup a socket server using business logic (Java), like how you’d do with a vps.
I’ve downloaded and setup the coderunner correctly, linked it to my IDE (IntelliJ IDEA) but it gives this error

"[ERROR] There is no code, which can be deployed to Backendless."

I’m sure the code has no errors thats why I want to know if its possible to create the socket server in the first place… or if I’m doing something wrong somehow.

Hi Edgar,

Since business logic is only run on a special event or by a schedule, and also considering that business logic is currently limited to one thread only, I don’t think it’ll be of any use to create a socket server there. Actually, the whole Backendless platform is a server, so maybe if you specify your requirements we could advice you on how to achieve them using the built-in service.

And also to avoid the error you’re getting, you need to compile your source code first so that the .class files appear.

ah yes… now that you mention it I did read somewhere on the documentation that the source code has to be compiled…anyway I’m developing an android app that links people to cabs, like “uber” or “lift” so I’m thinking of implementing the server side using sockets…for real time comm…A client sends a request to the server, which then distributes the request to the cabs. Are you guys capable of hosting such an event? Note that the client traffic may become large…

P.S thanks for replying :slight_smile:

Our messaging service is a perfect fit for that, the publish-subscribe scheme: https://backendless.com/documentation/messaging/rest/messaging_overview.htm

Thank you :slight_smile:

is not really, if you want real-time msging using sockets you cant…specially for some internal notifications like (user status, typing indicators, log term tasks completetion handlers etc)

So back to question…is it possible to run for example socket.io / mqtt on custom business logic service ?

No, it is not possible in that variant you have described. Business logic is not a set of hardware where you can run some server software, it is just a code, that is invoked on events. It has limits by size and invocation time (5Mb / 5 sec on free plan).
As Sergey mentioned above, you should use our Messaging api.

Your messaging api is not real-time communication first of all, secondly i mentioned couple of cases which are really not recommended to use with APNS/FCM…if you want to take some edge case:

You are building strategy game, and you want to inform other players about changes…you are not gonna send them push notifications i guess…but create socket connection, right ?

So what I am saying is, that you should use PUSH system to send messages if user’s app is in suspended state, and keep socket coms while app is in foreground. Partially it was/is doable with pub/sub method…but is not really feasible, because you need to have very short time period of checking channels -> which will end up with massive request/min count

You really should not use push messages for that, but you could use our built-in pubsub messaging. It might be a bit apicall-consuming for things like “writing a message…” in chat applications, but for many cases this still is enough real-time.

As we also responded in our slack channel, we’re planning support for sockets/websockets/something else real-time soon. Though it may take a few months to implement and approve, of course.

Yes, as I said, I know its “doable” even though its very old fasioned way…but still I guess you will be charging for this “Requests”, so this solution is not feasible.

I mean during dev process maybe, but once you go live and have at least 500users, you are screwed completely.

Obviously if you not counting pub/sub, thats different story… (which is my suggestion, at least until you implement real-time messaging solution)