Code Monkey home page Code Monkey logo

websocket-chat's Introduction

Websocket-chat

Using websocket protocol to write a Mini Chat APP
brew install libwebsockets
make
./server_t
./client_t room_name will return the port_num you need to go
./client search Jan/11/2021 room_name (request chat records on that day). And this command will create a file search_Jan/11/2021.txt in current working directory.
./client search today room_name will give you current records named today.txt.

client_t and server_t implementation use BSD kqueue only support in MacOs and Linux should use epoll (not implemented).

Server side supports sqlite3 DataBase to store the chat record, if you want to check the record in one specific date, try the command above. Also note that server side is using LRU cache to save answer.

For open the client side, please visit http://localhost:port_num/?name= YOUR NAME. The owner will have the right to remove other users, once the owner logout session, the second order connection user will become the new owner.

server_t.txt record the port_num table_name (table_name = time + room_name). client_t.txt record the port_num room_name.

Current implementation deploys different ports for different room since this project is more intended about multi-processes, and alternative implementation will be new packet format with room name.

websocket-chat's People

Contributors

wenkaizheng avatar

Watchers

James Cloos avatar  avatar

websocket-chat's Issues

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.