Backendless Support
 
Answered

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

  1. "[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.

Leave a Comment

Comments (9)

photo
1

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.

photo
1

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 :)

photo
1

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

photo
1

Thank you :)

photo
1

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 ?

photo
1

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.

photo
1

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

photo
1

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.

photo
1

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)

photo