Git Product home page Git Product logo

notify's Introduction

Hoplon Logo

Hoplon

clojars cljdoc badge

Hoplon is a ClojureScript library that unify some of the web platform's idiosyncrasies and present a fun way to design and build single-page web applications.

Hoplon tightly integrates with Javelin to reactively bind DOM elements to the underlying Javelin cell graph.

Quickstart

Install deps-new if you haven't already:

clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new

And then generate a starter project with:

clojure -Sdeps '{:deps {io.github.hoplon/project-template {:git/tag "v1.0.0" :git/sha "14361f1"}}}' -Tnew create :template hoplon/hoplon :name your/app-name

Example

A small bit of Hoplon:

(ns view.index
  (:require
    [hoplon.core  :as h]
    [hoplon.dom]
    [javelin.core :as j]))

(defn my-list [& items]
  (h/div :class "my-list"
    (apply h/ul (map #(h/li (h/div :class "my-list-item" %)) items))))

(def clicks (j/cell 0))

(defn hello []
  (h/div
    (h/h1 "Hello, Hoplon")
    (my-list
      (h/span "first thing")
      (h/span "second thing"))
    (h/p (h/text "You've clicked ~{clicks} times, so far."))
    (h/button :click #(swap! clicks inc) "click me")))

Browser Support

Hoplon has been thoroughly tested on desktop and mobile devices against the following browsers:

IEdge Firefox Safari Chrome Opera Android

Documentation

Demos

Developing Hoplon itself

# build and install locally
clojure -T:build ci :snapshot true
clojure -T:build install :snapshot true

Testing

This setup will run tests using chrome-webdriver.

Setup

npm install
npm install -g karma-cli

Run

; Run tests in simple compilation
clojure -T:build test

; Run tests in advanced compilation
clojure -T:build advanced-test

Contributors

This project exists thanks to all the people who contribute.

License

Copyright (c) Alan Dipert and Micha Niskin. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse
Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can
be found in the file epl-v10.html at the root of this distribution. By using
this software in any fashion, you are agreeing to be bound by the terms of
this license. You must not remove this notice, or any other, from this software.

notify's People

Contributors

burn2delete avatar laforge49 avatar micha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

notify's Issues

Inactive session management

Sessions may be abandoned. Old sessions may become active again. As it stands, the server will track an ever-increasing number of sessions until restarted. And on restarted, clients are given no notice.

Lets start with a :new-session notification. When a request is received, after being assigned a session id as needed, if the session does not in the @unacked-notifications map, then the request is ignored and a :new-session notification is sent to the client. The client must now perform any required session initialization to sync up with the server.

We can also have a priority queue of session ids, keyed by time of last get-notification. When a session has been inactive for too long and/or there are too many sessions, the session is removed from both the priority queue and from the @unacked-notifications map.

We also need a query returning the number of active sessions.

Degrading poll timer

You can have a LOT of active sessions which are really not very active at all. Polling frequency should be high when the client is receiving notices and not so high when notices from the server are infrequent. We can specify a degrading poll timer with 3 numbers:

  1. The delay between polls after a notice has been received.
  2. The maximum delay between polls when no notices have been received for a while. And
  3. The number of milliseconds added to the delay each time a poll is sent.

This simple change will significantly reduce unnecessary traffic on popular web sites.

broadcast-notification

We need an easy way, i.e. a function, for the server to send a notification to all active sessions.

An active session is one with an entry in the map held by the unacked-notifications atom.

The function would take two arguments, the notification type key and the notification value.

timestamps on notifications

Time is so often overlooked, but in the end it is often needed. Especially if we add durability.

The cleanest way to do this will be to break backward compatibility. But at this point, that is hardly an issue.

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.