All Projects → atedja → go-eventcast

atedja / go-eventcast

Licence: other
Simple event broadcasting

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-eventcast

Laravel Fcm
🌐 A Laravel package to send Push Notifications to one or many devices of the user.
Stars: ✭ 56 (+154.55%)
Mutual labels:  channels
Beatserver
Beatserver, a periodic task scheduler for Django 🎵
Stars: ✭ 106 (+381.82%)
Mutual labels:  channels
Threadbox
Recursive Worker Threads in NodeJS
Stars: ✭ 181 (+722.73%)
Mutual labels:  channels
Weechat Autosort
Automatically keep your buffers sorted.
Stars: ✭ 69 (+213.64%)
Mutual labels:  channels
Awesome Courses
😏 📄 An awesome list of educational websites, YouTube playlists, channels and books about programming
Stars: ✭ 99 (+350%)
Mutual labels:  channels
Iptv
Android project for live streaming IPTV
Stars: ✭ 120 (+445.45%)
Mutual labels:  channels
Mortgageblockchainfabric
Mortgage Processing App using Hyperledger Fabric Blockchain. Uses channels for privacy and access, and restricts read/write previleges through endorsement policies
Stars: ✭ 45 (+104.55%)
Mutual labels:  channels
Xlchannelcontrol
iOS 仿腾讯新闻客户端的频道管理功能
Stars: ✭ 239 (+986.36%)
Mutual labels:  channels
Open.channelextensions
A set of extensions for optimizing/simplifying System.Threading.Channels usage.
Stars: ✭ 106 (+381.82%)
Mutual labels:  channels
Phoenix client
Elixir Phoenix Client for Channels
Stars: ✭ 180 (+718.18%)
Mutual labels:  channels
Chan
Pure C implementation of Go channels.
Stars: ✭ 1,208 (+5390.91%)
Mutual labels:  channels
Vice
Go channels at horizontal scale (powered by message queues)
Stars: ✭ 1,283 (+5731.82%)
Mutual labels:  channels
Visual Chatbot
☁️ 👀 💬 Visual Chatbot
Stars: ✭ 161 (+631.82%)
Mutual labels:  channels
Tinker app
Android热更新Tinker + 多渠道打包 + 加固的流程详解demo
Stars: ✭ 67 (+204.55%)
Mutual labels:  channels
Djangochannelsrestframework
A Rest-framework for websockets using Django channels-v3
Stars: ✭ 224 (+918.18%)
Mutual labels:  channels
Go Apns2
Go package for HTTP/2 Apple Push Notification Service.
Stars: ✭ 53 (+140.91%)
Mutual labels:  channels
Picons
High quality tv & radio logos for your channels, also known as picons.
Stars: ✭ 110 (+400%)
Mutual labels:  channels
AIO
Coroutine-based multithreading library for Delphi
Stars: ✭ 99 (+350%)
Mutual labels:  channels
Quiz
Ex 1 - Run timed quizzes via the command line
Stars: ✭ 234 (+963.64%)
Mutual labels:  channels
Graphene Django Subscriptions
This package adds support to Subscription's requests and its integration with websockets using Channels package.
Stars: ✭ 173 (+686.36%)
Mutual labels:  channels

eventcast

Build Status

Simple event broadcasting.

Examples

Signaling arbitrary number of workers

  // spawn workers
  for i := 0; i < 100; i++ {
    go func() {
      closed := eventcast.Listen("we are closed")
      for {
        select {
        case <-closed:
          return
        default:
          // do other things
        }
      }
    }()
  }

  // somewhere, sometime later..
  eventcast.Broadcast("we are closed")

Broadcasting a value to multiple listeners

  // goroutines waiting for some result or timeout.
  for i := 0; i < 10; i++ {
    go func() {
      select {
      case value := <-eventcast.Listen("result"):
        // do something with value
      case <-time.After(1 * time.Second):
        // timeout!
        break
      }
    }()
  }

  // some worker
  go func() {
    // doing something...

    value := "result of processing some data"
    eventcast.BroadcastWithValue("result", value)

    // continue doing more
  }()

Racing Your Pigs

  // go pig!
  finished := eventcast.Listen("finished")
  for i := 0; i < 10; i++ {
    go func(i int) {
      <-eventcast.Listen("ready")
      <-eventcast.Listen("set")
      <-eventcast.Listen("go")
      time.Sleep(time.Duration(rand.Intn(5000)) * time.Millisecond)
      eventcast.BroadcastWithValue("finished", i)
    }(i)
  }

  // Allow some time for the pigs to get ready
  <-time.After(10 * time.Milisecond)

  eventcast.Broadcast("ready")
  <-time.After(1 * time.Second)

  eventcast.Broadcast("set")
  <-time.After(1 * time.Second)

  eventcast.Broadcast("go")
  winner := <-finished
  fmt.Println("Winner is Pig", winner.(int))
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].