Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "socket io"
-
I'm not much a fan of JavaScript. In fact, I am not very fond of any dynamic language, but JavaScript is one of my least favorites.
But this isn't about that. I use NodeJS for all of my web serving. Why would I do that? Am I a masochist? Yes.
But this isn't about that. I use NodeJS because having the same language on client and server side is something that web has never really seen before, not in this scale. Something I really really love with NodeJS is socket connections. There's no JSON parsing, no annoying conversion of data types. You can get network data and use it AS IS. If you transmit over socket using JSON, as soon as that data arrives on the server, it is available to use. It gets me so hard.
JavaScript is built to be single-threaded, and this is rooted deep into the language. NodeJS knows this isn't gonna work. And while there's still no way to multi-thread, they still try their best and allow certain operations (Usually IO) to run async as if you were using ajax.
With modern versions of the language, the server and client side can share scripts! With the inclusion of the import keyword, for the first time I have ever seen, client and server can use the same fucking code. That is mindblowing.
Syntax is still fluffy and data types are still mushy but the ability to use the same language on both sides is respectable. Can't wait for WebASM to go mainstream and open this opportunity up to more languages!10 -
Isn't Perl a beutiful language? Just check the beutiful screenshot of a function I just written...
Also this is so beutiful. Did you know that you can actually print directly from a perl script?:
$qp = new PostScript::Simple(papersize => "A4",direction => "RightDown",coordorigin => "LeftTop", colour => 0, eps => 0, units => "pt");
$qp->newpage;
$qp->setfont("Courier", 20);
$qp->text(20,20,"Hello Devrant");
$psock = IO::Socket::INET->new(PeerAddr => "192.168.1.40", PeerPort => "9100", Proto => "tcp");
if ($psock) {
$psock->autoflush(1);
print $psock $qp->get();
close($psock);
}6 -
Socket IO released a major update not 8 days ago. I spent an hour getting a "400 Bad handshake method" until I discovered my server had updated to 3.0.1 but my client was still in 2.3.0.3
-
So I am making a real time chat app using MERN and socket.io but I was disappointed to discover that the newer version of socket.io ie 2.2.0 fails overtime on Chrome.
There is an issue open on the socket.io repo addressing this. Didn't they fucking test the code for Chrome before releasing a new update?7 -
Question: which is better approach?
1. Use push notifications to tell react website that new data is available
OR
2. Use SignalR (similar to socket.io) and push data in real time?
The down side of SignalR is server needs to map connections --> use more memory while push notifications doesn't require that12 -
Bloody fucking Android! Updates, updates and more updates! My development Nexus 5X won't allow me to sideload apps since it updated... Hello, printf debugging! Goodbye, profiler and debugger!
My hate for Android grows with each version after 4.0.$something... 2 was shit, I missed 3, 4 was OK, and since then it's going steeply down.
And don't get me started on Material Design...! Good luck figuring out what's a button and what's a label...
And what's up with the "let's keep all apps running all the time to save a few ms on start" philosophy!? Who thought that is a good idea!? Yeah, System.exit(0) works, but... Is it so hard to determine when it's not needed anymore (has no services running etc.)? Why should a web browser (for example) stay in memory after I quit? Minimize is a thing (Home button), why make it so confusing?
Another thing - feedback-less async tasks - why? I like to know when it is working in the background... How the hell am I supposed to find out if it is supposed to do this or if it is frozen?
And Android deciding to kill your process whenever it pleases without any callback... Happened to me once with an Activity in the foreground (no exceptions anywhere in my app, it just quit). How do you do IO properly? It seems you can't guarantee some file or socket or something that must be closed doesn't stay open (requiring to restart Bluetooth 'cause the socket wasn't closed, for example)...4 -
Hey guys just a small question, when should nodejs be used. Ik for chats and stuff its great i used socket io before but i mean if a client wants a very basic website is it worth using nodejs or should i just stick to php. (Php haters kindly dont answer)1