Examples for Node.js
this example use three type of websocket server implementation
socket.io and sockjs are all implements a weird, arbitrary layer over the WebSocket protocol, which need server side support.
raw websocket server https://github.com/websockets/ws
socket.io https://github.com/socketio/socket.io (did not work, no error, no request if use path option, the api is not good)
https://github.com/socketio/socket.io-client (the path option did not work)
use proxy to access express server
proxy also work with websocket protocol
How To Run
npm run dev
cd src/client npm start
Server side rendering by next.js associating with expressjs
using AdminLTE which depend on bootstrap@3 and jquery
create with templateexpress-template
it works much better than next.js and have better document for now. But..., still a tentative way to me. Have not much confidence to use it in real production.
- the eslint --fix did not fix the error, so I ignore all the source in the .eslintignore
how to run
I have the problem as same as nextjs custom server build size is too big
npm build, then
npm startwhich with NODE_ENV = production, the main.js is still 1.2M, and there are hot reloading, it seems the production env did not work.
- there are not much resource to find the answer to eresolve the problem.
so for now, I will not update the example until there are more progress of the popularity of the next.
How to run
please see the shell run-dev.sh, change the environment variable in the shell then run from the meteor project folder
Collections and pub/sub methods
subscribe to mongolist, render with react and Tracker.autorun.
use methods to update.
subscribe to mongolist, render with withtrack.
use methods to update.
subscribe to customer collection, which actually is a local collection
UI and theme
show how to use meteor accounts-password to login
show how to use meteor accounts-password to create a new user by email and password
show how use mongo dirver 3.1 api to do transaction, it will make the publication know the change, but there will be an obviously time gap and the meteor native collection will not affected by the transaction as they are in another database connection. NOTE:as transaction only work in a replica set(mongo 4.0). so will have error like Transaction numbers are only allowed on a replica set member when you run in local machine with one mongo node.
show how to apply theme layout of Material Dashboard, also show do logout of the account
tried local collection without mongodb, it will not publish the change across the connections as each collection is a local collection.
So, use mongodb if you using meteor, otherwise, most feature dispear!!!
func is not a function
just remove aldeed:simple-schema from .meteor/packages and .meteor/versions
import SimpleSchema from 'simpl-schema'; instead
module cycle require
refer to this article ES modules: A cartoon deep-dive
but we should not mess our code up like such a require relation.
go into folder misc_examples\src\module_cycle_require