Git Product home page Git Product logo

serverless-sockets's Introduction

serverless-sockets's People

Contributors

duart38 avatar grevend avatar

Stargazers

 avatar

Watchers

 avatar  avatar

serverless-sockets's Issues

Enforce types in plug return types

The default record definition is too broad and is preventing this behaviour.
Bonus: we could potentially make the type enforcement conditional by tricking typescript into thinking one config variable is static/readonly

readyState not OPEN error

error: Uncaught (in promise) InvalidStateError: readyState not OPEN
        s.send(SocketMessage.encode(Object.assign(data, { type: EventType.BROADCAST, payload: { ...data.payload } })))
          ^
    at WebSocket.send (deno:ext/websocket/01_websocket.js:290:15)
    at https://raw.githubusercontent.com/duart38/serverless-sockets/main/src/server/Socket.ts:98:11
    at Set.forEach (<anonymous>)
    at Function.broadcast (https://raw.githubusercontent.com/duart38/serverless-sockets/main/src/server/Socket.ts:96:24)
    at https://raw.githubusercontent.com/duart38/serverless-sockets/main/src/server/EventHandler.ts:45:16

Presumably happening because we axed some try-catch blocks..

Generating modules point to local files instead of OTA

import { Log } from "../components/Log.ts";
import { SocketMessage } from "../interface/message.ts";
import { ModuleGenerator } from "../interface/socketFunction.ts";

export async function* renameMe(message: SocketMessage, from: number): ModuleGenerator {
    Log.info(`Message from ${from}, ${message.payload}`);
    yield { // this is how you return values. you can also use to return keyword to exit early.
        event: "Greet", // you may send back any event to the client side. it is up to them if they want to act upon it or not.
        // type: EventType.BROADCAST, // uncomment this to send a broadcast event instead (sends message to all connected clients excluding the one that initiated)
        payload: { // your can put anything in this one.
            name: `Hello ${from}, i got your message`
        }
    }
}

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.