Giter Club home page Giter Club logo

vassonic's Introduction

VasSonic: A Lightweight And High-performance Hybrid Framework

license PRs Welcome wiki

logo

VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform. Not only does VasSonic supports the static or dynamic websites which are rendered by server, but it is also compatible with web offline resource perfectly.

VasSonic uses custom url connection instead of original network connection to request the index html, so it can request resource in advance or parallel to avoid waiting for the view initialization. In this parallel case, VasSonic can read and render partial data by WebKit or Blink kernel without spending too much time waiting for the end of data stream.

VasSonic can cache html cleverly according to VasSonic Specification obeyed by client and server. VasSonic Specification specify template and data by inserting different comment anchor, templates are bigger parts of html which stay the same or changed rarely , in contradiction data, which is the smaller and constantly change part of html. According to this, VasSonic request less data by incremental updating templates and data, the websites are faster and feel more like native application. In conclusion, VasSonic effectively enhance the user experience and increase click rate, retention rate and other indicators.

Sonic is called for short in project.

Before VS After Using VasSonic

Pic 1: Before Using VasSonic Pic 2: After Using VasSonic
default mode VasSonic mode

Getting started

Getting started with Android

Getting started with iOS

Getting started with Java

Getting started with Node.js

Getting started with PHP

Getting started with React

Demo Downloads

  1. Here are the latest sample demo for Android and iOS.

Support

Any problem?

  1. Learn more from the following sample.
    Android sample
    iOS sample
    Java sample
    Node.js sample
    PHP sample
    React sample

  2. Read the following source code
    Android source code
    iOS source code
    Java source code Node.js source code
    PHP source code
    React source code

  3. Read the wiki for help.

  4. Contact us or scan QR code for help.
    QR code

Contributing

For more information about contributing issues or pull requests, see our VasSonic Contributing Guide.

License

VasSonic is under the BSD license. See the LICENSE file for details.

The End

If you are interested in VasSonic, don't forget to STAR it.

VasSonic's mission is MAKING WEB MUCH BETTER!

Thank you for reading ~

vassonic's People

Contributors

civerzhu avatar felixxfwang avatar iquanduan avatar jackyshan avatar lovekidan avatar marlonlu avatar richieli avatar sonic-ios-dev avatar vasdeveloper avatar zhantong avatar zhongwuzw avatar zyprosoft avatar zyvincent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vassonic's Issues

iOS SonicCache中的方法isAllCacheExist:实现有问题

原实现为:

- (BOOL)isAllCacheExist:(NSString *)sessionID
{
    BOOL isExist = [self checkCacheTypeExist:SonicCacheTypeConfig sessionID:sessionID];
    isExist = [self checkCacheTypeExist:SonicCacheTypeHtml sessionID:sessionID];
    isExist = [self checkCacheTypeExist:SonicCacheTypeTemplate sessionID:sessionID];
    isExist = [self checkCacheTypeExist:SonicCacheTypeData sessionID:sessionID];
    return isExist;
}

这一段返回的永远是 SonicCacheTypeData 是否exist,正确的逻辑应该是这样吧?

- (BOOL)isAllCacheExist:(NSString *)sessionID
{
    //Config check list
    NSUInteger checkList[4] = {
        SonicCacheTypeConfig,
        SonicCacheTypeHtml,
        SonicCacheTypeTemplate,
        SonicCacheTypeData
    };
    
    for (int i=0; i<4; i++) {
        if (![self checkCacheTypeExist:checkList[i] sessionID:sessionID]) { return NO; }
    }
    
    return YES;
}

allowBackup的问题

SDK里面不应该去设置这个属性,应该用占位符的形式来做tools:replace="android.allowBackup"
具体报错信息如下:

Error:Execution failed for task ':XXX:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:90:9-36
  	is also present at [com.tencent.sonic:sdk:1.0.0] AndroidManifest.xml:12:9-35 value=(true).
  	Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:88:5-1746:19 to override.

非常好用,已经在iOS项目中使用了

最近团队因为原生加载网页慢的问题被PM骂的狗血淋头,无意中发现手Q开源的这个框架,第一时间集成使用,大爱啊,完美解决!!!32个赞👍,感谢!!!

有点唬人的赶脚

第一次加载性能并没有提升多少,第二次加载速度快无非就是加载了缓存而已;非VasSonic的WebView如果配置了缓存,速度也慢不了多少。。。

后台技术匹配

如果后台技术不是node.js和PHP技术,部署起来是否麻烦,是否有相关的部署方案?

多餘的?

關於下圖 紅框內的程式碼, 似乎可有可無?
2017-08-19_094910

因為顯示出來的畫面效果是一樣的, 還是我有誤解的地方?

Android 预加载问题

预加载是调用如下代码嘛?

SonicSessionConfig.Builder sessionConfigBuilder = new SonicSessionConfig.Builder();
SonicEngine.getInstance().preCreateSession(url,sessionConfigBuilder.build());

为什么没有效果呢?

请问,混合框架中js的运用方向是什么?

看了看源码,发现有一个JSbridge,但是没有看到相关源码,是否是忘了上传?
这个框架对于将JS混合开发运用到了什么地方?
还有,此框架的特点出来并行流式加载和缓存外,还有什么特点吗?
感谢回答,不尽感激!

请教2个问题?

非常感谢你们为的开源做出的努力!读完源码有几个问题不明白,想请教一下。

  1. 查看源码,首屏加速的原理在于,将webview 初始化的过程中,并行调用原生的网络请求去加载部分网络资源,判断webview的加载时机去采用何种的资源合成方式? 此处如果一开始就全局初始化好了一个webview供后面的WebActivity调用不是也可以避免这种初始化耗时吗?
  2. 测试子页面的加载速度并没有非常明显的提速效果?操作方式上需要注意哪些吗?

iOS 无法支持loadHtmlString的加速吗

目前是只能优化本地文件和url,但是有时候后台会返回一段html文字,里面也有图片,文字格式等,这个能否支持呢。
另外能否上传到pod?我发现你们出品的库似乎都没优先考虑支持pod

iOS 打包时候报错

引入Sonic.framework,打包的时候报错
Sonic.framework/Sonic(SonicUitil.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build for architecture arm64

腾讯X5 WebView

Sonic 和腾讯 X5 WebView我做了一个对比,发现页面加载速度相似,但是不知道二者有什么分别?分别适用于什么情景?

create session fail!

08-17 11:52:04.894 18739-18739/com.tencent.sonic E/chromium: [ERROR:interface_registry.cc(104)] Failed to locate a binder for interface: autofill::mojom::PasswordManagerDriver
08-17 11:52:04.926 1272-5616/? E/HsmCoreServiceImpl: onTransact in code is: 103
08-17 11:52:05.016 1272-1430/? E/WifiConfigManager: updateConfiguration freq=5180
08-17 11:52:05.848 18739-18739/com.tencent.sonic E/SonicSdk_SonicEngine: internalCreateSession error:sessionId(sonic-demo-master_19c4325bc41bc0162610b9358ad2bca7) is running now.
08-17 11:52:05.848 18739-18739/com.tencent.sonic E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tencent.sonic, PID: 18739
java.lang.UnknownError: create session fail!
at com.tencent.sonic.demo.BrowserActivity.onCreate(BrowserActivity.java:113)
at android.app.Activity.performCreate(Activity.java:6910)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6524)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
08-17 11:52:05.853 1272-6070/? E/ReportTools: This is not beta user build
08-17 11:52:05.946 1272-1682/? E/HsmCoreServiceImpl: onTransact in code is: 103

VasSonic通信

请问VasSonic有没有自带JSBridge这样的通信框架?需要自定义吗?

Nodejs的demo3中,sonicStatus状态码和diff对应的业务逻辑并不相符

感谢Vas小组的开源工作,今晚仔细看了一下vasSonic在node上的源码和demo,有一些疑问,想和开发者一起交流一下。
nodejs_demo3 这个demo中 我发现sonicMode的状态码的说明和diff.js的sonicMode似乎并不对应

状态码的说明:

//1-sonic首次 2-页面刷新 3-局部刷新 4-完全cache

但是结合diff的逻辑,当sonicMode为0时,属于完全cache,对应sonicStatus的4;

sonicMode为1,2和3时,都属于探知到存在sonic模板的情况,分为以下两种情况:

  • 1和3都在同一处理逻辑中,根据我的理解,1对应为首次刷新,也就是sonicStatus的1; 3对应为模板发生了变化,需要页面全部刷新,也就是sonicStatus的2;
  • @sonicMode为2时,模板并未变化,而数据变化,故应对应局部刷新,也就是sonicStatus的3;

sonicMode为4时,属于未探知到sonic模板,所以直接全部刷新,故也完全刷新,对应sonicStatus2

不知我的理解是否正确?如果的确存在如上的情况,不知是有意将sonicStatus和sonicMode的对应关系打乱的,还是无意为之呢?

php sdk里的getallheaders函数兼容性问题

PHP Fatal error: Call to undefined function getallheaders()
getallheaders这个函数在非Apache服务器下,如nginx或FastCGI模式下可能不存在,可以考虑$_SERVER['HTTP_XXX']方式获取request header。

sonic能和x5结合吗?

如题,android由于需要嵌入直播网页,遇到很多机型无法打开直播视频的问题,项目中使用了x5的webview,请问sonic兼容x5 webview吗。实测在华为mata8 crash

请问加载速度的提升是服务端、移动端、前端共同优化的成果?

我是移动端的,最近打算优化Webview的加载速度,然后下了demo体验了一把。demo中的加载速度和离线加载,确实速度快了不少。如果将demo中的url改成我自己项目的url,速度还是一样的。那么问题来了,提升加载速度是服务端、客户端、前段一起优化的结果?如果只是客户端做优化,服务端不参与,能达到demo中的效果吗?

X5 的兼容问题

setWebViewClient(new WebViewClient(){
@OverRide
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
if (sonicSession != null) {
return (WebResourceResponse) sonicSession.getSessionClient().requestResource(url);
}
return null;
}
});

shouldInterceptRequest 方法需要返回 com.tencent.smtt.export.external.interfaces.WebResourceResponse,
而 sonicSession 返回的是 android.webkit.WebResourceResponse

08-17 02:18:55.353 3661-3725/com.mobileclient W/System.err: java.lang.ClassCastException: android.webkit.WebResourceResponse cannot be cast to com.tencent.smtt.export.external.interfaces.WebResourceResponse
08-17 02:18:55.353 3661-3725/com.mobileclient W/System.err: at com.mobileclient.X5WebViewManager$1.shouldInterceptRequest(X5WebViewManager.java:118)
08-17 02:18:55.353 3661-3725/com.mobileclient W/System.err: at com.mobileclient.X5WebViewManager$1.shouldInterceptRequest(X5WebViewManager.java:112)
08-17 02:18:55.353 3661-3725/com.mobileclient W/System.err: at com.tencent.smtt.sdk.z.shouldInterceptRequest(Unknown Source)
08-17 02:18:55.353 3661-3725/com.mobileclient W/System.err: at com.android.webview.chromium.WebViewContentsClientAdapter.shouldInterceptRequest(WebViewContentsClientAdapter.java:313)
08-17 02:18:55.353 3661-3725/com.mobileclient W/System.err: at com.android.org.chromium.android_webview.AwContents$IoThreadClientImpl.shouldInterceptRequest(AwContents.java:326)
08-17 02:18:55.353 3661-3725/com.mobileclient W/System.err: at com.android.org.chromium.android_webview.AwContentsIoThreadClient.shouldInterceptRequest(AwContentsIoThreadClient.java:62)

在小米3上跑android demo 用了sonic比没有sonic更慢

刚刚用小米3跑了下demo,发现用了sonic之后,网页白屏很久才加载成功,在第一次白屏很久的时候,我点了返回,再进去,还报了个session创建失败的错误。
接着我用夜神模拟器跑了一下,发现用了sonic之后有些许提升,但是点了回退键之后报了一堆ServiceConnectionLeaked。
感谢tencent团队的贡献,希望sonic能越做越好

敢不敢写份中文文档

你们写的洋码子其实我差不多也能看懂,但是你们是腾讯啊,给同胞们设置这么一个小门槛是几个意思?就算对标国际化,难道额外给一份中文文档很费劲么?给**广大程序员解释一下。

SonicSession的serverIP属性在iOS的SoincSDK中并没用使用到

请看SonicClient的- (void)createSessionWithUrl:(NSString *)url withWebDelegate:(id)aWebDelegate方法的如下代码:
...
if (!existSession) {
existSession = [[SonicSession alloc] initWithUrl:url withWebDelegate:aWebDelegate];
NSURL *cUrl = [NSURL URLWithString:url];
existSession.serverIP = [self.ipDomains objectForKey:cUrl.host];
}
...
我发现SonicSession的serverIP属性有且只在SonicSession的setupConfigRequestHeaders方法中使用,但是SonicSession的setupConfigRequestHeaders方法在[[SonicSession alloc] initWithUrl:url withWebDelegate:aWebDelegate]中调用,然而existSession的serverIP赋值是在[[SonicSession alloc] initWithUrl:url withWebDelegate:aWebDelegate]下面调用
由此推断此属性并没有使用到

报错了

coolpad 8720l
shou手机配置信息
image

E/dalvikvm: VM aborting
A/libc: Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 6651 (pool-sonic-sess)

image

看不懂文档,请更改

原谅我只有一年iOS开发经验,我看你们的文档一天了,实在无从下手;请更新一下文档,让我们这些菜鸟也能用上这些新技术

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.