A
A
Alexander2017-06-26 00:20:04
Node.js
Alexander, 2017-06-26 00:20:04

How to make friends vue.js and websockets?

What are ready-made solutions for implementing vue and node interaction via websockets? Whether it is necessary to limit interaction only to websockets at all? As I understand it, this significantly reduces the cost of constant reconnections. Doesn't this get in the way of the REST concept?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Basharin, 2017-09-15
@LordGuard

Already resolved the issue?
1) The first question has already been answered
2) It's up to you to decide if you should limit yourself to them or use AJAX + WS. One-time rare requests are best done through AJAX. If the client opens one page, and constantly does some manipulations with sending to the server, then you can give preference to web sockets. 4) REST, as far as I know, is built on HTTP, if we talk about the RESTful ideology, then read about the basic principles, there seem to be six of them, if you can follow all of them, then it won’t really matter which protocol is based on.
3) Yes, this will reduce the cost of reconnecting. The main feature is that the server itself can initiate events, without a request from the client, this is the main advantage. It is also worth considering that the language constructs and libraries for working with AJAX and WS differ both in terms of convenience and quantity, so you should also look at the convenience of development.

S
sim3x, 2017-06-26
@sim3x

https://www.google.com.ua/search?q=vuejs+websockets
0. https://github.com/icebob/vue-websocket

E
emp1re, 2017-06-26
@emp1re

If you don’t want to implement Rooms and Namespaces, look towards socket.io, on nodejs, on the front, I think it doesn’t matter, but it might be easier to connect their lib.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question