Code Monkey home page Code Monkey logo

app's Introduction

Larandomizer

Larandomizer is a websocket server application written with Laravel and React PHP to give away prizes at meetups and conferences and to teach async in PHP. This repository is the Laravel application that you install and deploy. It includes all the necessary ReactPHP components as dependencies.

From the talk, It's All PHP I Promise

Installation

The application installs like any Laravel application. The following shows one possible way to install the application. While Composer is required, Yarn is optional and you could just as easily use NPM instead.

git clone https://github.com/larandomizer/app ./
composer install
yarn install
npm run production
cp .env.example .env
php artisan key:generate

Extra Dependencies

If you plan to use any AWS resources and specifically the S3 filesystem then you will want to install the league/flysystem-aws-s3-v3 dependency. If you plan to use the APIs to interact with the Beanstalkd realtime queue bridge then you'll also need to install the pda/pheanstalk dependency:

  • composer require league/flysystem-aws-s3-v3 ~1.0
  • composer require pda/pheanstalk ~3.0

Usage Guide

This application depends on artisansdk/server which is a service-based, Laravel PHP implementation of an async, realtime, WebSocket server you also can use in your realtime dashboards and applications. See this package's readme for more installation and configuration notes including a usage guide.

TLDR: Run php artisan server:start and the app connects to wss://localhost:8080.

Configuration Settings

The configuration settings of the artisansdk/server service have been published to config/server.php which is where you will be able to customize some of the settings. Additionally the .env.example file already has the environmental variables included for customization.

Licensing

Copyright (c) 2017 Artisans Collaborative

This package is released under the MIT license. Please see the LICENSE file distributed with every copy of the code for commercial licensing terms.

app's People

Contributors

dalabarge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

app's Issues

Adding Prize Does Not Broadcast

Problem:
On local branch 1.2 the prizes are added and broadcasted no problem but in production deployment 1.2.0 the prizes are not working. The AddPrize message is sent from the client to the server but the server does not respond with the expected broadcast of UpdatePrizes message.

Fix:

  • It might be a difference between PHP 5.6 and 7.1
  • It might be a difference between collections such as Prizes and Connections
  • It might be a break between the registered message and command listeners

Prize Count Should Not Reset When Winner Leaves

Problem:
If a prize is awarded and the winner disconnects, the prize count increments when in fact that prize is not longer available.

Fix:
Prizes that have been awarded should have a boolean awarded to indicate they have been given to the winner. That way, even if the winner drops connection the prize counter will not be changed.

Losers Are Not Being Indicated

Problem:
If all the available prizes are given out only the connections awarded a prize are updated to winner, leaving all the losers as still player type: but there are no more prizes so they are indeed losers.

Fix:
When a prize is awarded, a check should occur to see if more prizes are available. If not, then all player type connections should be changed to loser type connections. If a new prize is added then all loser type connections should be changed back to player type connections.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.