0

I'm designing a web application that should communicate with a remote raspberry (or similar devices for what it matters)

I need to achieve these goals:

  • user be able to send commands and receive answers
  • device be able to send data on his own initiative
  • when the user is offline, the application server should be able to get updates from the device

https://i.stack.imgur.com/hHbPb.png

Actually I'm at this stage of designing. I cannot figure out what to put in A and B boxes. I was thinking about node.js on the B side, and it would work very smooth if I only needed to send direct commands from the frontend, but I also need to update the DB and get the application and the raspberry communicate when the user is offline.

Any ideas? Thanks a lot.

user2799534
  • 183
  • 1
  • 1
  • 7
  • Sounds interesting. What about RMI? http://stackoverflow.com/questions/911882/is-it-possible-to-use-rmi-bidirectional-between-two-classes – Stefan Jun 23 '14 at 15:22
  • Couple of questions. How do you want to scale it? Is it just a school project? – ra2085 Jun 23 '14 at 16:01
  • Why do you want to separate box A from the Spring box? – ra2085 Jun 23 '14 at 16:07
  • Also, Why would you want two way communication between box A and B? Isn't it easier to just put a client app on box B to continuously check/update for changes on box A? – ra2085 Jun 23 '14 at 16:09
  • Are you collecting data from the external sensors/devices? If so, I strongly reccomend to use a lightweight protocol to do it. You've got to look into MQTT. – ra2085 Jun 23 '14 at 16:10
  • Hi, it's not a school project, the number of raspberry are going to grow during time. The communication must be 2-way because the raspberry is going to use GPRS connection, I want to avoid a polling mechanism. The data is collected by the phy devices, that uses the raspberry as an interface to the web. Box A is just a service, which should be able to instantiate a new connection. How would you handle the task within the spring box? Thanks for the advices. – user2799534 Jun 24 '14 at 07:28
  • @user2799534 Did you find any solution? I want to do same thing and I don't know what should I do?Can you explain what did you do ? – faraa Aug 22 '16 at 19:05

1 Answers1

0

To answer your question, I need to make few assumptions:

  • you have chosen SpringMVC because you're familiar with Java,
  • you read from Raspberry comes in via GPIO pins
  • you're ok with polling Raspberry for data
  • you want to narrow down the amount of technologies used

Then this one may help:

http://elinux.org/RPi_Low-level_peripherals#Java_Webapp_GPIO_web_control_via_http

Dimitry K
  • 2,236
  • 1
  • 28
  • 37
  • Actually the raspberry is used only to communicate with another device via RS232, I don't use the GPIO. Classical user cases: Case 1: User submit a command to the raspberry, which translate it into proprietary protocol and send it to the device, it takes the answer and send a reply as a JSON object to the web application. Case 2: The phy device sends a message to the raspberry (e.g. an alarm) and the raspberry has to communicate it to the web app. The web application is used to let different user control N devices each (and they can be a lot). I'm open to suggestions. Thank you. – user2799534 Jun 24 '14 at 08:11