Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Will my implementation of a Spring Boot app work after being deployed on the Internet?

+2
−0

Say I want to implement a very basic group chat application. I use the H2 database, a user class, a controller, and a text file in the Resources folder that stores the chat texts. All texts would be appended to the text file and a JS function would refresh the page periodically with the file data. Now of course this will directly work only within my network. But if I upload this project to Heroku or something similar, would it still work as intended?

Almost all examples online use WebSocket. I'm unable to understand why because everyone connecting to the my app online will be served by the same controller and append data to the same text file. Or am I completely wrong?

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (1 comment)

1 answer

+2
−0

Now of course this will directly work only within my network. But if I upload this project to Heroku or something similar, would it still work as intended?

I'll assume that you actually have the project working on your network. The only advice I can really give you here is, "Try it and see if it works." And if it doesn't work, debug.

Almost all examples online use WebSocket. I'm unable to understand why because everyone connecting to the my app online will be served by the same controller and append data to the same text file. Or am I completely wrong?

The reason most examples use WebSocket is because WebSockets are bi-directional. i.e, the server can push data to the client without being asked for it. Obviously, this is ideal for real-time chat applications, where you want the server to send you chat updates as fast as possible.

In your case though, you are using the "repeatedly polling the server for data" method. While theoretically, this would work, it would only update the chat log as fast as the client requests data. Further, depending on how frequently you poll the server, this can be resource intensive on the server because the data is being repeatedly requested even when there are no changes. However, it does have the advantage of not having to maintain an active connection, so if you don't need real-time updates then this is a perfectly viable method.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »