• Stars
    star
    965
  • Rank 47,414 (Top 1.0 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ”ฅ An online poker game server powered by Redis, node.js and socket.io

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:

  • Chat Room (่Šๅคฉๅฎค)
  • Jinhua (่ฏˆ้‡‘่Šฑ/ไธ‰ๅผ ็‰Œ)
  • Texas Holdem (ๅพทๅทžๆ‰‘ๅ…‹)
  • Fight Landlord (ๆ–—ๅœฐไธป)
  • Blackjack (21็‚น)

Features:

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

TODO List:

  • Client API for Unity3D (C#, support mono/.NET2.0)
  • Payment gateway callback URL.
  • Admin Portal.
  • Load balancing: using NginX, or auto handled if deployed to Amazon Cloud.

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

See Also

  • socket.io for Unity3D, is a socket.io client library for Unity3D. You can develop casino games with Unity3D, and using this library to connect to this casino server.

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# for Unity, Java, Objective-C, C/C++, etc.)
  • Help us write documentation, if your English is good.

More Repositories

1

cordova-admob-pro

๐Ÿ”ฅ Cordova Plugin for Google AdMob, DFP, ADX. Easy monetization using mobile Ad, with single line of JavaScript. Compatible with Cordova CLI, Inoic, PhoneGap Build, etc.
Java
716
star
2

socket.io-unity

socket.io client for Unity, power game client with node.js back-end
481
star
3

cordova-httpd

Embed tiny web server into Cordova with a plugin
Objective-C
282
star
4

cordova-plugin-admob

Basic Cordova Plugin for AdMob
C#
264
star
5

cordova-plugin-nativeaudio

The low latency audio plugin is designed to enable low latency and polyphonic audio from Cordova/PhoneGap applications, using a very simple and basic API.
Objective-C
234
star
6

coding-to-monetization

๐Ÿ“– From Coding to Monetization๏ผšProgrammer's Financial Freedom Approach
189
star
7

cordova-plugin-sms

Plugin to operate SMS, send / list / intercept / delete / restore
Java
169
star
8

cordova-plugin-facebookads

Cordova/PhoneGap plugin for Facebook Audience Network Ads
Objective-C
65
star
9

protogen

CLI tool to parse protobuf .proto to C#, based on protobuf-net, works on Windows/Mac/Linux
XSLT
65
star
10

LiteCsvParser

A lite CSV reader and writer in C#, without any heavy dependency
C#
49
star
11

ipa-deploy

Deploy .IPA package to iOS device with a command line tool
Python
43
star
12

cordova-plugin-iad

Cordova plugin to support iAd on iOS
Objective-C
38
star
13

cordova-plugin-iflyspeech

Cordova plugin to support speech recognizer and synthesizer with iFlyTek voice cloud service
Objective-C
33
star
14

cordova-iad-pro

Cordova/PhoneGap Plugin for iAd with Banner and Interstitial
Objective-C
20
star
15

cordova-plugin-flurry

Cordova plugin to support Flurry (analytics and advertisement)
Objective-C
19
star
16

cordova-plugin-wifi

Cordova plugin to access mobile device Wifi info and operation
Java
19
star
17

admob-demo-game-phaser

Demo game for Cordova AdMob plugin, using phaser game engine
JavaScript
18
star
18

cordova-plugin-mopub

Cordova/PhoneGap plugin for MoPub Ads
Objective-C
17
star
19

raymud

Web-based MUD powered by nodejs and socket.io
CSS
16
star
20

gomoku

Gomoku, a HTML5 game working on PC and mobile device
JavaScript
13
star
21

hiquant

Quatitative trading framework and out-of-box toolset for assisting stock/fund investment
Python
13
star
22

magpie

General plugin framework for Cocos2d-x to call Cordova plugins
Shell
13
star
23

cordova-plugin-appleiap

Cordova plugin to support In-App Purchase on iOS
Objective-C
11
star
24

cordova-plugin-qq

Cordova plugin for Tencent QQ OpenSDK
Objective-C
11
star
25

admob-demo-app-ionic

JavaScript
11
star
26

UnityBatchBuild

Batch build toolset for Unity
Python
10
star
27

cordova-plugin-mmedia

Cordova/PhoneGap for Millennial Media Ad
Objective-C
8
star
28

cordova-smart-adserver

Cordova/PhoneGap Plugin for Smart Ad Server
Objective-C
8
star
29

cordova-mobfox-pro

Enhanced MobFox plugin for Cordova/PhoneGap. Banner, Interstitial and Video Ad. Support many other Ad network with server-side integration.
JavaScript
8
star
30

cordova-plugin-lianlianpay

Cordova/PhoneGap plugin for LianLianPay SDK
Java
7
star
31

plugin-verify

A simple utility to verify a Cordova plugin with its own test sample index.html
JavaScript
5
star
32

hotjs

A HTML5/javascript game/app framework written in javascript, in object-oriented way.
JavaScript
5
star
33

charset-convert

A command line tool to convert text file from one charset to another
JavaScript
5
star
34

cordova-plugin-paypalmpl

Cordova Plugin for PayPal MPL Library, not for new SDK.
Objective-C
5
star
35

mixin-pro

Improved javascript mixin to realize multiple inheritance for code reuse
JavaScript
4
star
36

cordova-admobsdk

Google Mobile Ads SDK for Cordova
Objective-C
3
star
37

cordova-admob-adapters

Cordova plugin for AdMob adapters
Objective-C
3
star
38

gomoku2

Gomoku HTML5 Game, newly written with HotJS Framework
JavaScript
3
star
39

cordova-plugin-ext

Extend the Cordova plugin base class with adapter interface. Plugin written based on this interface, can also be used for Unity, Cocos2d-X, and other frameworks.
Java
3
star
40

cordova-plugin-easyad

The easiest way to add AdMob/iAd to Cordova Apps
Objective-C
2
star
41

MagpieDemo

Demo Project for Magpie Framework, Call Cordova Plugins in Cocos2d-X Game
C++
2
star
42

knowledge-management

An Illustrated Guide to Knowledge Management
2
star
43

cordova-plugin-chartboost

Cordova plugin for Chartboost Ads
Objective-C
2
star
44

brackets-eclipse-theme

Eclipse light theme for Brackets
CSS
2
star
45

google-admob-sdk

Add Google Ads SDK to Cordova/PhoneGap project
Objective-C
2
star
46

webrpc

A reusable API server/client framework, running on socket.io
JavaScript
2
star
47

admob-demo-xdk

AdMob Demo for Intel XDK and Cordova Project
JavaScript
1
star
48

cordova-admob-xdk

Cordova AdMob Plugin for Intel XDK
C++
1
star
49

chinafund

Python
1
star
50

phonegap-jumprope

Jumping rope is cheap, portable, and burns more calories than you might think, try this mobile app
JavaScript
1
star
51

handycorp

A hybrid APP and its back-end, developed with javascript
JavaScript
1
star
52

testpaypalmpl

Demo project for cordova-plugin-paypalmpl
Java
1
star
53

admob-demo-game-pixi

Demo game for Cordova AdMob plugin, using PIXI game engine
JavaScript
1
star
54

cordova-facebook-sdk

Facebook SDK for Cordova
Objective-C
1
star
55

jump-rope

Jumping rope is cheap, portable, and burns more calories than you might think, try this mobile app
Java
1
star
56

cordova-plugin-vungle

Cordova Plugin for Vungle
Objective-C
1
star
57

cordova-plugin-appgrade

Cordova plugin for AppGrade
1
star
58

ajax-local

Some workaround to allow AJAX to load local resources
JavaScript
1
star