项目作者: farhanramadhan

项目描述 :
messages-api
高级语言: Go
项目地址: git://github.com/farhanramadhan/messages-api.git
创建时间: 2020-03-14T04:22:31Z
项目社区:https://github.com/farhanramadhan/messages-api

开源协议:

下载


messages-api

Simple API that use Go, MQTT for a simple messaging API

How To Run

  1. 1. Ensure Go and MQTT installed on your computer
  2. 2. type `make run` / `go run main.go` to run the program or `make test` / `go test -v ./...` to test the program

Simple API

1. API for sending a message Just send one parameter string for message After sending should be get response (REST / GraphQL / etc)
  1. localhost:8080/message/{message}
2. API for collect message that has been sent out API can get all previously sent messages (REST / GraphQL / etc)
  1. localhost:8080/message
3. API for display message in real time API should be long live connection to retrieve messages after send at realtime (MQTT / Websocket / etc)
  1. Server act as a publisher and a subscriber with mqtt server.
  2. Default address for mqtt : `mqtt://<username>:<password>@<address>:<port>/<topic>`.
  3. Address mqtt in mylocal : `mqtt://mqtt_user_name:mqtt_password@localhost:1883/message-api-realtime`.
  4. subscriber clientID : `sub`
  5. publisher clientID : `pub`
  6. When server receiving GET request for sending message, the publisher will publish the body of the message and the subscriber will receive the message.
Created By : Farhan Ramadhan Syah Khair