Mahmoud Hesham
Mahmoud Hesham

Reputation: 73

What's websockets and what js framework should I use

I'm very new to the Java Script world , I use Laravel already for my backend but when it came to the websockets part I kinda got messy , because when I looked for websockets I have read that they all are depending on Node JS for real time apps like chat apps but also I have seen a tutorial making a chat app in Vue Js & laravel echo only without using node js ,

now the messy part for me is , If I want to learn socket.io (for example) should I learn Node Js first ? And is Vue js an alternative for the socketio ? and How about the ajax ? isn't it able to do the same performance ?

I'm sorry but It's kinda messy for me , I have looked for that but it is still messy for me , thanks for advance

Upvotes: 3

Views: 2121

Answers (2)

elC0mpa
elC0mpa

Reputation: 126

I agree with everything exposed in the accepted answer except that Vuejs isn't an alternative. It is true that vuejs is a javascript framework to create frontends, but, if you have a nodejs server with a socketio server, you need a client (frontend) which must be able to communicate through socketio. You can see this by yourself here, this is one of the most common vue wrappers library to use socketio from vuejs. I hope this could help

Upvotes: 0

molamk
molamk

Reputation: 4126

If I want to learn socket.io (for example) should I learn Node Js first?

Yes. Since Socket.IO is a Node.js package, it's kind of a pre-requisite to learn Node. It's one of the easiest tools to learn though, so don't be intimidated.

And is Vue js an alternative for the socketio?

No. Vue.js is front-end framework, which means it's used to build the part of the website you actually see. Socket.io is a package (or framework) that enables bi-directional communication between the front-end and the back-end of your application. You can use it for example to build a chat application.

How about the ajax ? isn't it able to do the same performance?

No. Ajax is short for Asynchronous JavaScript And XML. Which basically means that you use Ajax requests from the front-end to the back-end. The difference here is that Websockets/Socket.IO gives you the bi-directional communication that Ajax lacks. You don't need Socket.IO for all communication though

Upvotes: 6

Related Questions