What I'd like to achieve:
have a main server running node.js and socket.io that runs a "chat-like" webpage, like this chat example. On this server I'll also have a mongo database where I store multimedia files and tags. I have no plan to use the filesystem to store data and metadata, so I choose gridFS.
having multiple client machines all over the world that can connect to my server, giving me back their MAC addresses as idintificator. These machines have their own local copy of the main server's database, that needs to be updated if some media or tags are missing. I need to be able to match the local db to the main one.
in the "chat" page I can type predefined textual commands that trigger useful actions, such as sending back to the main db a video or audio typing in the chat "[client MAC address] GET VIDEO ('video.mp4')"..
Now as a newbie my question is: can I do this with only node, socket.io, gridFS and javascript?
There are better alternatives?
Related
For my job, I am doing research on finding a means on how a web application running locally from file:\ in IE11, created with either HTML5 or Javascript, can access the raw data or listen to a computer's serial port being sent out from a windows service or proxy. The situation is that We have a proxy designed to collect data from a computer's serial port and it will send that data outward on our network to the local host.
What we want our web application to do is to catch that data the proxy is sending out directly from the service on the computer, removing the need to have the proxy send the data to a server and having the web application collect the data from a server. So far googling the solution has been difficult. Does anyone know the solution to our problem or knows where to find the solution?
Lazy people, why don't you use Google search bar (!?!)...
Here: https://github.com/garrows/browser-serialport
Note: You cannot use this in a Web page, i.e. cannot put it on a Web server. And it is supported only by Chrome.
Long time lurker first time poster. Hi.
I've got a Node.js backend server, serving React.js in the front end. I'm uploading a huge amount of mp3 and wav files to the server itself currently. That is, a user uploads a file in my front end, and I create a folder on the server the node instance is running on and store the mp3/wav there, pertaining to that user.
The project is moving out of development into production, and I'm wondering from a scalability perspective a) how bad is this practice b) what my best options are for hosting, and c) alternative options to storing files on the server itself.
There is an existing user base of about 500 users, each of which uploads about 600MB - 1.5GB of media every 1.5 months.
Any insight would be great, as search seems inconclusive. Thanks!
I suggest you integrate with CDN cloud servers. e.g dropbox,google, or AWS . its has very flexible API including role based access, and authentication.
Even if you want to keep on your server, I suggest to run separate server only to upload/download files and create oauth based authentication, system.
In case you also want to go for streaming. Then also there are cloud server which offer streaming support like wows,airplayit etc.
i've created a project(asp.net) - website
The database resides on the client machine.
Flow:
Client opens the website, and submit with the required fields, and then the server would authenticate.
Next, the api what i've created should be transferred to the Client pc, as the database would be accessible only where the client and server at the same system only.
Limitation: cannot move the database to the server, ie making database on the server.
If i'm hosting website on the localhost, everything is running fine, and also m fetching data from the database and i can see it on the browser.
But the same if i'm hosting website on server, m not able to fetch any result.
Is there any method or so, to execute on the client system that would be making connection between the cient browser and database residing on the client system only.
The whole scenario is same as of: bloomberg (what i came to knw about my issue and the bloomberg as a public db to be used issue), where bbg restricts its usage on the web, and bbg is accessble only for the client system for the client n on that client account only.
ON STRAIGHT: is it possible to access the client machine database or an application by browser.
Because i after making opening the website and also making some input and then submit, the call should call api which will access the data to be shown on browser would be from the client pc.(lets say - database resides at client pc)
No, there is no way to access a traditional database on a PC directly from the browser. You'd need a web app in the middle, so that your browser accesses the web app, and this offers indirect access to the database.
If you can install a web app that has access to the PC database, there are interesting ASP.NET and browser technologies to access the data: Web API OData + breeeze.js.
The only alternative would be to use HTML5 Storage databases, but they are still under definition and mostly unsupported. See, for example, this page: HTML5 Features: Storage. An this is not what you're looking for.
One of my University assignments is to develop a P2P file sharing web application to transfer files between machines on the same local network. I'm not looking for a handout on how to do this, I can figure it out once I get the high level design down, I just need to know if this is sane.
I'm planning on using the PeerJS library. From what I can tell each client gets a unique ID and these IDs are used to connect clients to each other. So somehow I need to coordinate IDs between all the clients on the same local network.
The way I was planning on doing this is to have a NodeJS server running with Socket.IO. When the client loads the web application, they send a websocket request to the Node server. The node server then records the external IP address of the client. When another client connects and makes a request with the same external IP address as another client, those two clients are given each other's IDs so they can connect to each other.
There are a few potential problems with this:
I'm assuming people with the same external IP address are on the same local network. Would this be wrong in any situations?
I don't know how the file transfer between clients will happen. Ideally it should be isolated to the local network. For example if I'm transferring a file between two computers it will go: computer 1 -> router/switch -> computer 2, not something like computer 1 -> router/switch -> local exchange -> ISP switch -> local exchange -> router/switch -> computer 2. Basically the transfer shouldn't leave the local network onto the Internet.
Thoughts?
Is it possible to allow two clients interact directly without a server?
I am referring to websites, for example is it possible to create a chat between two clients that are on the same website using only javascript on the client-side.
If not, what's the minimum server-side to make a chat work between active clients on a website? (eg: one PHP file and no database) ?
My idea:
Storing the conversation would be easily done using localStorage on each client, the problem is how to send some data from client1 to client2 without storing anything (or at most that message) in the database. Also, note that "past" conversations should not visible, so no storage needed for that.
Note that I don't want any nodeJS or websocket solutions, I want something as simple as possible. So, what's the minimum code and files to make a chat between online users?
The WebRTC APIs will allow JavaScript to initiate a direct browser-to-browser connection, but a server is still required to serve the page and coordinate session initiation.
The APIs are still rapidly evolving and only available in bleeding-edge browsers, so it's not yet ready for real production use.
However—to be honest—for what you're trying to do, the easiest option is Node and socket.io:
var http=require('http'), express=require('express'), sio = require('socket.io')
, app=express(), srv = http.createServer(app);
app.use(express.static(__dirname+'/static'));
sio.listen(srv);
srv.listen(80);
...and now you have a working websockets server in 5 lines. Put all your client-side stuff in the static folder and you're good to go.
HTML5 has got a new Web Sockets feature
With this the server intervention is almost nullified..The server and client communicate through the new protocols
ws - Web Sockets protocol
wss - Web Sockets Secure protocol (similar to https)
Live demo
No, It's not possible. If you want a chat box, you have to store the data in the server. And what connects the clients, like display the chat texts and the same things to every client, they come from the server.. So it's not possible like that. Well, even free chat boxes put the data of each sites in their servers.
As for your idea using localStorage, maybe it's possible (But still, using the new WebSocket protocol), but it doesn't work in the time dimension, right? if another user joins, they won't see what has been sent before.