当前位置: 首页 > 软件库 > 大数据 > 数据查询 >

apollo2-subscriptions-how-to

Apollo Server 2 how to setup subscriptions
授权协议 Readme
开发语言 Java
所属分类 大数据、 数据查询
软件类型 开源软件
地区 不详
投 递 者 宗政霄
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Apollo server 2.0

This project is a good starting point for all the people that want to have apollo-server 2.0 ready to use.It integrates:

  • queries
  • mutations
  • subscriptions (real-time data)
  • authentication and authorisation (using google sign-on as provider server)
  • schema stitching
  • mongo db
  • logger (it will create a file error.log and write on it in case of error - to change the level edit common/util/logger.ts lines 12, 13, 14 )

Installation:

Environment

In the root folder is available a file called .env. It contains all the configuration environment for:

  1. mongodb
  2. google-sign-in as identity server for authentication and authorisation. More info available at http://www.dzurico.com/apollo-server-2-0-auth-with-google-signin/

available commands

  • test environment: npm run dev(it will automatically rerun your code all the time you save and will check for tslint errors and formatting style errors.)
  • production environment: npm run prod

How to configure prettier on your editor:

Webstorm

alt text

VS Code

prettier-vscode can be installed using the extension sidebar. Search for Prettier - Code formatter. It can also be installed using ext install prettier-vscode in the command palette.

Other editors

https://prettier.io/docs/en/editors.html

Playground

  1. hello world
query {
  hello
}
  1. fetch all the posts:
query {
  posts {
    author
    comment
  }
}
  1. add a new post
mutation {
  addPost(author: "Daniele Zurico", comment: "www.dzurico.com") {
    author
    comment
  }
}
  1. realtime data (Subscription) for post
subscription {
  postAdded {
    author
    comment
  }
}

alt text

  1. fetch all the users (you need to be authenticated with google identity server):For more information how to setup: http://www.dzurico.com/apollo-server-2-0-auth-with-google-signin/
query{
  users {
    id
    name
    surname
  }
}

For a better explanation on how I setup this repo please refer to:

  1. http://www.dzurico.com/apolloserver-2-0-how-to-create-a-graphql-server/
  2. http://www.dzurico.com/apollo-server-2-0-auth-with-google-signin/
  3. http://www.dzurico.com/apollo-server-2-0-real-time-data-with-subscriptions/
  • 一、MQTT协议配置 为了使用MQTT协议,首先使用MQTT3.1协议的客户端连接到Apollo正在监听端口。Apollo会做协议检测,而且自动识别MQTT连接,而且将连接作为MQTT协议处理。 你不必要为MQTT协议打开一个端口(STomp,Openfire,AMQP等都是自动识别)。如果你一定指定连接的协议,有下面两种方式:你可以选择不用协议识别,而是为MQTT指定连接: <connector

  •         官网英文参考: http://activemq.apache.org/apollo/documentation/mqtt-manual.html  MQTT协议 Apollo允许客户端通过开放的MQTT协议连接。该协议主要是用在资源有限的驱动上,以及网络不稳定的情况下使用,是一个订阅、发布模型。这种驱动通常不适用类似http,stomp这类基于文本,或者类似openfire,AMQ

 相关资料
  • Rinvex Subscriptions Rinvex Subscriptions is a flexible plans and subscription management system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architectu

  • graphql-subscriptions GraphQL subscriptions is a simple npm package that lets you wire up GraphQL with a pubsub system (like Redis) to implement subscriptions in GraphQL. You can use it with any Graph

  • graphql-redis-subscriptions This package implements the PubSubEngine Interface from the graphql-subscriptions package and also the new AsyncIterator interface.It allows you to connect your subscriptio

  • When an entry is created, a series of slots are created as well. These slots have different responsibilities, some for tracing, some for collecting and calculating run-time information, some for flow

  • Contents Introduction Define Resource "try" and "catch" mode Bool mode Annotation mode Check block exception Resource for asynchronous entries Configure Rules Definitions of rules HTTP APIs for rules

  • Requests is under active development, and contributions are more than welcome! Check for open issues or open a fresh issue to start a discussion around a bug. There is a Contributor Friendly tag for i