Giter VIP home page Giter VIP logo

chat-vue's Introduction

Chat simples utilizando Websocket, Vue.JS e PHP

O Websocket é um protocolo que nos permite abrir uma comunicação bidirecional com o servidor utilizando um único soquete TCP (Transmission Control Protocol) através do navegador. Sendo assim, tanto o cliente quanto o servidor podem enviar informações entre si a qualquer momento.

No lado cliente utilizaremos o Vue.JS para facilitar a construção da interface do chat, além de manter um código mais organizado.

No lado servidor utilizaremos o Ratchet que é uma biblioteca PHP que nos permite construir um servidor de Websocket de um jeito descomplicado.

No diretório server: Basta rodar "composer install" no terminal.

Agora precisamos executar este arquivo para iniciar nosso servidor de Websocket. Para isso você precisa ir até o terminal, navegar até a pasta dele e executar o comando abaixo:

$ php server.php

Pronto, agora nosso servidor de Websocket foi iniciado.

Para executar o projeto, rodar a URL: localhost:8080

========================================================

Simple chat using Websocket, Vue.JS and PHP

Websocket is a protocol that allows us to open two-way communication with the server using a single Transmission Control Protocol (TCP) socket through the browser. Therefore, both client and server can send information to each other at any time.

On the client side we will use Vue.JS to make it easier to build the chat interface, as well as to maintain a more organized code.

On the server side we will use Ratchet which is a PHP library that allows us to build a websocket server in an uncomplicated way.

In the server directory: Just run "composer install" on the terminal.

Now we need to run this file to start our Websocket server. For this you need to go to the terminal, navigate to its folder and execute the command below:

$ php server.php

Okay, now our Websocket server has started.

To run the project, run the URL: localhost: 8080

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.