cleanup
This commit is contained in:
parent
94a7e36297
commit
cd180a6d8c
12 changed files with 16 additions and 11 deletions
|
|
@ -3,9 +3,9 @@ package main
|
||||||
import (
|
import (
|
||||||
"github.com/maddalax/htmgo/extensions/websocket"
|
"github.com/maddalax/htmgo/extensions/websocket"
|
||||||
ws2 "github.com/maddalax/htmgo/extensions/websocket/opts"
|
ws2 "github.com/maddalax/htmgo/extensions/websocket/opts"
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/framework/h"
|
"github.com/maddalax/htmgo/framework/h"
|
||||||
"github.com/maddalax/htmgo/framework/service"
|
"github.com/maddalax/htmgo/framework/service"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"ws-example/__htmgo"
|
"ws-example/__htmgo"
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package pages
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/ws"
|
"github.com/maddalax/htmgo/extensions/websocket/ws"
|
||||||
"github.com/maddalax/htmgo/framework/h"
|
"github.com/maddalax/htmgo/framework/h"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
"ws-example/partials"
|
"ws-example/partials"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,12 @@ import (
|
||||||
|
|
||||||
func RootPage(ctx *h.RequestContext, children ...h.Ren) h.Ren {
|
func RootPage(ctx *h.RequestContext, children ...h.Ren) h.Ren {
|
||||||
return h.Html(
|
return h.Html(
|
||||||
h.HxExtension(h.BaseExtensions()),
|
h.JoinExtensions(
|
||||||
|
h.HxExtension(
|
||||||
|
h.BaseExtensions(),
|
||||||
|
),
|
||||||
|
h.HxExtension("ws"),
|
||||||
|
),
|
||||||
h.Head(
|
h.Head(
|
||||||
h.Link("/public/main.css", "stylesheet"),
|
h.Link("/public/main.css", "stylesheet"),
|
||||||
h.Script("/public/htmgo.js"),
|
h.Script("/public/htmgo.js"),
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package ws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/ws"
|
"github.com/maddalax/htmgo/extensions/websocket/ws"
|
||||||
"github.com/maddalax/htmgo/framework/h"
|
"github.com/maddalax/htmgo/framework/h"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
"ws-example/pages"
|
"ws-example/pages"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package partials
|
package partials
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/ws"
|
"github.com/maddalax/htmgo/extensions/websocket/ws"
|
||||||
"github.com/maddalax/htmgo/framework/h"
|
"github.com/maddalax/htmgo/framework/h"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Counter struct {
|
type Counter struct {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package ws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/framework/h"
|
"github.com/maddalax/htmgo/framework/h"
|
||||||
"github.com/maddalax/htmgo/framework/service"
|
"github.com/maddalax/htmgo/framework/service"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// PushServerSideEvent sends a server side event this specific session
|
// PushServerSideEvent sends a server side event this specific session
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package ws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/framework/h"
|
"github.com/maddalax/htmgo/framework/h"
|
||||||
"github.com/maddalax/htmgo/framework/service"
|
"github.com/maddalax/htmgo/framework/service"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package ws
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package ws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/framework/service"
|
"github.com/maddalax/htmgo/framework/service"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func StartListener(locator *service.Locator) {
|
func StartListener(locator *service.Locator) {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package ws
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
"github.com/maddalax/htmgo/extensions/websocket/internal/wsutil"
|
||||||
|
"github.com/maddalax/htmgo/extensions/websocket/session"
|
||||||
"github.com/maddalax/htmgo/framework/h"
|
"github.com/maddalax/htmgo/framework/h"
|
||||||
"github.com/maddalax/htmgo/framework/session"
|
|
||||||
"github.com/puzpuzpuz/xsync/v3"
|
"github.com/puzpuzpuz/xsync/v3"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package h
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
func BaseExtensions() string {
|
func BaseExtensions() string {
|
||||||
extensions := []string{"path-deps", "response-targets", "mutation-error", "htmgo", "sse", "ws"}
|
extensions := []string{"path-deps", "response-targets", "mutation-error", "htmgo", "sse"}
|
||||||
if IsDevelopment() {
|
if IsDevelopment() {
|
||||||
extensions = append(extensions, "livereload")
|
extensions = append(extensions, "livereload")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue