Jump to content
IElite

Websockets OR Node?

Recommended Posts

I need my web browser app to grab a JSON file from our website and the JSON will eventually  be edited/updated  within the app and then needs to be to the website and saved/overwritten.

Which of these methods would be best? Websockets or Node? I am thinking it probably can only be done with Node?

 

Share this post


Link to post
Share on other sites

it depends

websockets is but one mechanism for client-server communication. Node supports ws but there are php websocket implementations as well. Node runs on most if not all platforms, but there are alternatives.

Ultimately you'll have to make choices re client type (browser web app, native, ...), communication protocol (websocket, ajax/xmlhttp, ...), middleware (if any), server platform (windows, linux, cloud, ...), server language (node/smart/js, delphi, php, aws), back-end database (oracle, mysql, firebase, ...).

These choices will be influenced / dictated by the functional requirements of your app (is your json file unique for all users or per user, do updates need to be pushed in real time, ...), scale (concurrent clients), reliability, availability and costs (all servers incur costs, although some providers provide limited free tiers).

hny

 

Share this post


Link to post
Share on other sites

Are you looking for a solution for the client app or the server side? Basically, in node you can write a small server that listens to get and post requests. In get, you send the json file the server has and with post you retrieve the changed json file. The client only has to then do simple get/post requests using TW3HttpRequest.

However, it's never a good idea to blindly trust the json-file that the client sends. If the client only does small and finite changes to the json, you can pretty easily make your own api for changing the json-file.  When you do that, the client sends post requests to the server and the server checks and updates the json based on the parameters in the requests.

Share this post


Link to post
Share on other sites

@jarto - interesting question. Can this be done using just the Client App?

If I have my app sitting on our server. If the App uses a JSON file,  a user loads the app, the JSON file is served to them using TW3HTTPRequest, But when changes are made, how is the file updated/saved so the next user is able to use the updated JSON information?   It was my understanding that you can do any file manipulation using the client? 

 

 

 

Share this post


Link to post
Share on other sites

No, it can't just be a client app. You need a server app also. You just have to decide, how extensive a server app you want to make.

If you have a minimal server app with just the json download/upload, your client app needs to contain all the business logic. If you move the business logic and data manipulation to the server, the client app can be very simple. It just has to display data and ask the server to make changes.

Share this post


Link to post
Share on other sites
On 1/2/2019 at 3:18 AM, jarto said:

No, it can't just be a client app. You need a server app also. You just have to decide, how extensive a server app you want to make.

If you have a minimal server app with just the json download/upload, your client app needs to contain all the business logic. If you move the business logic and data manipulation to the server, the client app can be very simple. It just has to display data and ask the server to make changes.

That is what I thought, I guess I misunderstood your previous post

thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×