Skip to content

mlt180/graphql-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-graphql

Create GraphQL Api Service + Realtime PubSub use Golang

Installation

  • MYSQL (currently use MYSQL database)
  • Change database connection in /config/config.go
  • Import schema.sql to database
mysql -u root -p YOUR-DATABASE-NAME < schema.sql

start Server

go run main.go

Test PubSub From JS Client In Browser console

var ws = new WebSocket("ws://127.0.0.1:3001/ws");

ws.onmessage = (msg) => {
	console.log("received server message:", msg.data)
}

// Subscribe to a topic

ws.send('{"action": "subscribe", "topic": "topic-xyz"}')


// Publish a message

ws.send('{"action": "public", "topic": "topic-xyz", "message": "Your message"}')

About

Create GraphQL Api Service + Realtime PubSub use Golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages