npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

casino-server

v0.1.6

Published

An multi-rule scalable online poker game server powered by redis, node.js and socket.io

Downloads

17

Readme

casino-server

npm version

Build Status

NPM

An online poker game server powered by redis, node.js and socket.io

A A A

Game rules supported:

  • [x] Chat Room (聊天室)
  • [x] Jinhua (诈金花/三张牌)
  • [x] Texas Holdem (德州扑克)
  • [ ] Fight Landlord (斗地主)
  • [ ] Blackjack (21点)

Features:

  • [x] Cross-platform: powered by node.js, easy to deploy on various platforms.
  • [x] Scalable: using Redis as message bus and data storage.
  • [x] Open architecture: with Redis as the message bus, easy to interact and extend.
  • [x] Cluster: using PM2, sticky session, and socket.io-redis.
  • [x] WebSocket protocol: come with javascript client API and web-based demo.
  • [x] Event logger for server events and user actions.

TODO List:

  • [ ] Load balancing: using NginX as load balancer.
  • [ ] Client API in other language (priority: C/C++, C#, Java, Objective-C, etc.)
  • [ ] Payment gateway callback URL.
  • [ ] Admin Portal.

Architecture

Architecture

Required

  • Redis

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

Download

  • node.js / npm

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Download

  • PM2 (production & cluster)

PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.

Read More

Installation

  • Installing globally and run as service with PM2:
[sudo] npm install pm2 -g
[sudo] npm install casino-server -g

# run redis-server first
redis-server &

# run as service and cluster mode
pm2 start `which casino-server` -i 0
  • Installing as a node app, and run in current folder:
git clone https://github.com/floatinghotpot/casino-server.git casino
cd casino
npm install
# sudo npm install -g gulp
# gulp build
node bin/casino-server [options]

Now you can visit http://localhost:7000, it's a web-based game client for testing and demo purpose.

# open a browser to access the test web page
open http://localhost:7000/

Available Options:

-p Port to use (defaults to 7000)

-h Host address to use (defaults to 0.0.0.0)

-r Address of Redis server (defaults to 127.0.0.1:6379)

Tools

With Redis as the message bus, it's very easy for tools to work with the open architecture.

Event Logger

Start the event logger to monitor the events:

bin/logger.js

Or, log the events into log file:

bin/logger.js -o ./tmp/casino.log

Credits

This poker game server is created by Raymond Xie, published under MIT license.

It can be used for FREE, but be aware that:

  • It is provided as it is. (Not a mature commercial product, may be incomplete, or even lots of bugs)
  • We will mainly focus on our own needs.
  • You can propose wish for new features, but don't rely on us to implement them. Instead of waiting for new features, welcome join us to implement them.
  • You need take your own risk, including that you need find answers from reading code instead of easily asking only. :P

If you are interested in this project, you can contribute in any of following aspects:

  • Simply "Star" it.
  • Use it or test it, report bugs or even send pull request of patches.
  • Add better HTML5 demo client.
  • Add new poker game rules.
  • Add client APIs in other languages (like C/C++, C#, Java, etc.)
  • Help us write documentation, if your English is good.