프로젝트
GitHub에서 보기
logux/server
소개
원하는 언어로 Logux 서버를 직접 만들거나 WebSocket과 HTTP 백엔드 사이에 프록시를 구축할 수 있습니다.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalLogux Server
Logux is a new way to connect client and server. Instead of sending HTTP requests (e.g., AJAX and GraphQL) it synchronizes log of operations between client, server, and other clients.
- Guide, recipes, and API
- Issues and roadmap
- Projects inside Logux ecosystem
This repository contains Logux server with:
- Framework to write own server.
- Proxy between WebSocket and HTTP server on any other language.
Logux Server is built by Evil Martians, an American design and engineering consultancy for developer tools, AI, and cybersecurity startups.
Logux Server as Framework
import { isFirstOlder } from '@logux/core'
import { dirname } from 'path'
import { Server } from '@logux/server'
const server = new Server(
Server.loadOptions(process, {
subprotocol: 1,
minSubprotocol: 1,
root: import.meta.dirname
})
)
server.auth(async ({ userId, token }) => {
const user = await findUserByToken(token)
return !!user && userId === user.id
})
server.channel('user/:id', {
access(ctx, action, meta) {
return ctx.params.id === ctx.userId
},
async load(ctx, action, meta) {
const user = await db.loadUser(ctx.params.id)
return { type: 'USER_NAME', name: user.name }
}
})
server.type('CHANGE_NAME', {
access(ctx, action, meta) {
return action.user === ctx.userId
},
resend(ctx, action, meta) {
return { channel: `user/${ctx.userId}` }
},
async process(ctx, action, meta) {
if (isFirstOlder(lastNameChange(action.user), meta)) {
await db.changeUserName({ id: action.user, name: action.name })
}
}
})
server.listen()
관련 프로젝트 살펴보기
불러오는 중…