Skip to content

server event

Emiel Mols edited this page Aug 12, 2015 · 1 revision

server: event

Create and push events to user devices.

Event = require 'event'

Event.create
	unit: msg
	text: "A new message awaits!"

Functions

create(opts)

Adds new event. opts should be an object.

When opts.include is not set, the event is sent to all Happening members.

Key Value
unit Type of event. (mandatory)
text Text to show when the event is shown by itself.
picture Url to a picture.
include When an array of member ids, only send to those members.
exclude When an array of member ids, exclude those members from recipients.
read When an an array of member ids, directly mark as read for those members and do not send push notification.

Example:

	exports.client_event = !->
		# send push event to all group members
		Event = require 'event'
		
		Event.create
			text: "Test event"
			# sender: Plugin.userId() # prevent push (but bubble) to sender
			# for: [1, 2] # to only include group members 1 and 2
			# for: [-3] # to exclude group member 3
			# for: ['admin', 2] # to group admins and member 2

markRead(forMemberId)

Mark all events for this plugin/member as read. forMemberId is mandatory.

Basic topics

API reference

  • API Reference
    • Client
      • [client plugin](client plugin)
      • [client dom](client dom)
      • [client obs](client obs)
      • [client db](client db)
      • [client server](client server)
      • [client page](client page)
      • [client ui](client ui)
      • [client form](client form)
      • [client icon](client icon)
      • [client modal](client modal)
      • [client photo](client photo)
      • [client photoview](client photoview)
      • [client time](client time)
      • [client share](client share)
      • [client map](client map)
      • [client geoloc](client geoloc)
    • Server
      • [server event](server event)
      • [server plugin](server plugin)
      • [server http](server http)
      • [server db](server db)
      • [server photo](server photo)
      • [server time](server time)
  • Example UI elements

Advanced topics

Clone this wiki locally